Outbound Emails

All PHP and WordPress sites in EasyEngine come with Postfix configured to send emails. So out of the box, for any site, PHP’s mail() or WordPress’s wp_mail() function should work.

To test if mails sending are working on a site, run:

ee shell example.com

# For WordPress site
wp eval 'echo wp_mail("[email protected]","Hello Human","Hello from EasyEngine!");'

ADVERTISEMENT
# For PHP site php -r 'mail("[email protected]", "Hello Human", "Hello from EasyEngine!");'

Using AWS SES for outbound emails

If you are going to use AWS SES with WordPress, we recommend using Human Made’s aws-ses-wp-mail WordPress plugin.

If you want to use external service for sending emails, Postfix is not needed and can be disabled.

ADVERTISEMENT

However command to disable Postfix is not yet in EasyEngine. It will be available in future release. You can track it’s progress here.

Mailhog

During development, you may want to disable all outbound emails and capture them for debugging. In such case, you can enable mailhog on the site.

When you enable Mailhog, Postfix sends all the outgoing emails to Mailhog instead of sending them to actual mail server.

After enabling Mailhog, go to example.com/ee-admin/mailhog. Here you will see all the mail that your application has sent.

mailhog screen

⚠️ If you’re using Mailhog in production, don’t forget to turn it off.
⚠️ Emails sent through SMTP will still be sent to actual mail servers. Only emails sent through PHP’s mail function will be catched by Mailhog.