Why you should route WP mail via SMTP.

Send emails via SMTP on WordPress

By default your self-hosted WordPress website will send all email notifications using the WP mail method, via your server. I've noticed that the shared servers of many hosting providers prevent notifications from being correctly delivered to their recipients.

 Very often for security purposes: they don't want your website to act as a relay for spammers.

To ensure that your notifications are properly delivered, which is essential if you're running an e-commerce website or if you have multiple lead gen forms with auto-responders, you should route your emails via a third-party provider.

Either using the SMTP credentials attached to an email address (on your domain or on Gmail) or a transactional email service like Mandrill, Mailgun, Sendgrid or Amazon SES. Some people prefer to use a dedicated domain or a Gmail address to handle the notifications, to avoid opening a security breach into their own email server.

wp mail

There are multiple plugins in the WP repository which help you set up a SMTP route for WP mail, and dedicated plugins for the various transactional email providers.

The plugin I'm using for all my on-site forms, Formcraft, has a dedicated section to set up a SMTP connection for each form. You'll simply need to enter the details of the email address (username, password) + the SMTP Host (for instance, for Google, it's smtp.gmail.com) and select the port + type of connection, which depends on your email provider.