George McKinney Adventures in Software Development

November 8, 2022

Sending Mail from AWS Lightsail using WP MAIL SMTP by Shared Hosting (Mochahost!)

Filed under: AWS,Lightsail,Mochahost,PHP,WordPress — georgemck @ 9:21 pm

AWS Lightsail enables Amazon Web Services customers to host “simple web applications, use pre-configured development stacks like LAMP, Nginx, MEAN, and Node.js.” This includes WordPress-powered websites. Lightsail creates a Debian-based virtual server to host these applications allowing SSH connections. Unfortunately, unlike traditional shared hosting services,  mail functionality is not included. This prevents WordPress from sending emails normally including for password resets. Fortunately, there is an easy to use plugin (WP MAIL SMTP) that provides a number of options for sending email including  SendLayer, SMTP.com, Sendinblue, Mailgun, SendGrid, Postmark, SparkPost, Gmail, Microsoft, Amazon SES, Zoho, and All Other SMTP providers.

Since web services do not need to be provided by the same server address or even the same company. It is possible to split web application hosting from mail server hosting via customizing the DNS zone settings (That topic is not addressed here). The goal of this post is to point out the settings necessary to enable the Lightsail application to use mail settings from one of the “All Other SMTP” providers, specifically Mochahost.

First off, you must create an email account on Mochahost. By doing so, you will immediately know the username and password. The configuration for setting up a mail client are available. However, instead of using the website’s domain it is necessary to use the mail server domain in this case, mochaXXXX.mochahost.com. The port will be 587. Encryption will be TLS. Finally, authentication with username and password are required.

Here is an example of the WP MAIL SMTP plugin settings:

 

 

Now, send a test email:

 

And check your email:

 

All these companies provide great servers and, when you need to scale, you will be in good hands.

 

 

Powered by WordPress