Emails seemingly lost in space can be one of the most frustrating experiences of running a website. Here at the Ninja Dojo we receive a significant number of support requests for email responses seemingly not sending. Typically we find that the emails are being sent but aren’t arriving at their destinations due to issues with the host or the recipient’s email service. So what can you do if you’re suffering from disappearing WordPress email?
The knowledge you need to combat the problem is twofold, and we’ll spend this article and the next covering those points. In this article we’ll cover a little background on how emails are handled; i.e. what happens to them between clicking the Send key and arrival at the inbox. We’ll also look at how you can use that knowledge to take control of how emails are sent, increasing their general reliability. In our next article we’ll look in detail at how you can construct an email to have the best chance at success in avoiding spam filters.
There and Back Again
So what does the journey of an email look like after you click the send button? Let’s look at it from the perspective of an email response being triggered in Ninja Forms and assume for now that we’re not running into any problems like overzealous spam filters and the like. I’ll reference the image below as we go, sketched out in elegant detail by our support guru Zach.
Let’s assume for sake of argument that your email is going through your host and you are not using an email plugin like Mandrill or a WordPress SMTP plugin. We start at the top of the image at Ninja Forms. Your user has submitted their form and your email response triggers, sending them a confirmation email.
Our email data is passed first to WordPress’ wp_mail() function. This is the equivalent of you walking into the Post Office and giving your package to the worker at the desk.
Wp_mail() then calls the host server’s mail() function, and mail() collects the data passed by wp_mail(). This is the equivalent of the postal worker at the desk handing your package off to one of the post office’s delivery drivers. It’s wrapped in php code and then sent off to the recipient’s email server (gmail, hotmail, yahoo, etc). Email received and that’s it, journey’s over.
Maybe you don’t want to use the Post Office? There’s FedEx and UPS as well. There are other services dedicated to sending WordPress email that you can use instead. More on the services we recommend below! The sequence of events using an alternative service would be the same up until it got to wp_mail(). At that point, instead of calling the host server’s mail function, wp_mail() would route the email data to the recipient through the dedicated mail server of your choice (Gmail, etc).
And now you know an email’s tale.
The Dangers Along the Way
Every journey has its orcs and goblins. The most common pitfalls are being blocked while routing through the host, and getting caught in the spam filter on arrival at the recipient’s email server. We’ve talked previously about why email gets sent to spam and some quick tips to keep out of the spam folder. If you’re interested in learning how spam filters work, head over there anytime. Check back with us next week for an in depth look at how to design emails to pass spam filter checks. What we’re about to look at here is more about what can go wrong on your end.
Sending email through your host is the simplest option, but it comes at a risk. Consider a scenario where you have WordPress set up using your Gmail address to send and Bluehost as your web host. When wp_mail() passes to Bluehost’s mail(), Bluehost may reject the email outright. Reason being is that the email’s metadata will reflect being sent from Gmail with BlueHost as the origin. That makes the email more likely to be marked as spam by the recipient’s email server and reflects poorly on Bluehost. If Bluehost did allow the email to pass, then due to the conflict between the sent from & origin meta it is quite likely that it would be zapped by the recipient server’s spam filter. This can be worked around by using the email address bluehost provides for you, but then you don’t get to use your prefered address.
Alternatives to Using Your Host for WordPress Email
Alternatively you could use a dedicated service like Mailgun. The advantage is reliability: wp_mail() is being reconfigured to send the email data to Mailgun rather than the host server. Bypassing the host server not only eliminates the need to use the host’s email to prevent the sent from/origin conflict above, but it also lends the credibility of a trusted email server when the email passes the recipient server’s spam filter.
There’s so much more to email than send and go. Hopefully this has clued you in to the basics of what happens on your end after you click send. If you have questions about how you can optimize WordPress email to avoid spam filters at the recipient end, be sure to check back with us soon for an article dedicated to just that, and be sure not to miss our explanation of spam filters if you’re unfamiliar with how they operate. Understanding the system is the best way to improve on it!