As consumers, when we consider email services, we often think of applications like Gmail that seamlessly handle two crucial tasks for us: sending and receiving emails. Interestingly, these two functions are completely independent under the surface, to the extent that they have no awareness of each other.
Here is a good article to know the difference under the hood.
WordPress out of the box sends emails using PHP’s mail function. PHP in turn by default uses Sendmail.
The flow usually looks like this:
WordPress wp_mail() ➞ PHP mail() ➞ OS sendmail
On Linux servers, Sendmail is often used for email functionality, but it may not always be the most reliable option. You can enhance email reliability by substituting Sendmail with Postfix and enabling support for SPF and DKIM. We have an entire section in our tutorials dedicated to email configuration
In production installation, we generally use AWS SES. There is also an option of using Gmail SMTP with WordPress or even at the whole Linux OS level.
Alternatively, it is recommended do disable sending emails in the development environment or, even better, capture the sent emails using tools like Mailpit. Mailpit is included in Local by Flywheel.
Although WordPress does offer a method to add an email account that continuously checks for new emails and publishes everything sent to that email address.
If you want to process incoming emails, you need to have a publicly reachable mailbox such as [email protected] and then a program to “download” emails from this mailbox using something like IMAP or POP3.
In summary: