Overview
You can send PHP mail through an SMTP program instead of the default PHP mail function to improve email deliverability and avoid common issues such as a missing or improperly configured FROM address.
Background
When you use the PHP mail function it sends emails directly from your web server, which can cause deliverability issues, especially if the FROM address is not set correctly or if your email is hosted elsewhere. For more information, see the PHP mail troubleshooting article for further details.
How do I use SMTP with PHPMailer?
Sending email via SMTP is recommended because it uses a dedicated mail server, rather than the web server, to send email. This improves reliability and reduces the chances of your messages being marked as spam.
DreamHost recommends using PHPMailer to send email via SMTP. PHPMailer is a popular library for sending email securely and efficiently. It integrates easily with Google’s SMTP servers and provides extensive documentation. See the following articles for more information: