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)
- Install WP Mail SMTP plugin
- Go to Settings > WP Mail SMTP
- Enter SMTP server:
mail.yourdomain.com
- Use port 465 and SSL encryption
- Use your full email and password to authenticate
Joomla
- Go to Global Configuration > Server
- Set Mailer to SMTP
- Enter SMTP server:
mail.yourdomain.com
- Set port to 465 with SSL
- 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.