How to Configure PHP mail() or SMTP Authentication for Popular CMS


To ensure reliable email delivery, it’s best to use SMTP instead of the default mail() function. Here’s how to set it up for common CMS platforms:

WordPress (using WP Mail SMTP plugin)

  1. Install WP Mail SMTP plugin
  2. Go to Settings > WP Mail SMTP
  3. Enter SMTP server: mail.yourdomain.com
  4. Use port 465 and SSL encryption
  5. Use your full email and password to authenticate

Joomla

  1. Go to Global Configuration > Server
  2. Set Mailer to SMTP
  3. Enter SMTP server: mail.yourdomain.com
  4. Set port to 465 with SSL
  5. Enter your full email and password

Drupal

Use modules like SMTP Authentication Support or PHPMailer.

Why this matters: SMTP prevents emails from being flagged as spam and improves deliverability.