WordPress not sending emails on AWS EC2

Are you struggling with WordPress not sending emails on AWS EC2? This can be frustrating, especially when you rely on your website to send important notifications, order confirmations, or contact form messages.

Amazon Elastic Compute Cloud, also known as EC2, is a core component of Amazon Web Services (AWS) that provides a powerful infrastructure for hosting your WordPress site. However, configuring email services on AWS EC2 can be tricky, and any oversight can cause your WordPress site to not send emails properly.

In this guide, we’ll explore the common causes behind this problem and walk you through three easy steps to get your WordPress emails working reliably on AWS EC2.

Ready? Let’s get started!

4 Reasons Why WordPress Not Sending Emails on AWS EC2?

When your WordPress site hosted on AWS EC2 isn’t sending emails, it could be due to several underlying issues. Understanding these reasons can help you diagnose and fix the problem effectively.

AWS EC2 isn't sending emails

Below are four common reasons for WordPress not sending emails on AWS EC2:

1. SMTP is Disabled or Not Configured on Your EC2 Instance

Simple Mail Transfer Protocol (SMTP) is the industry standard for sending emails over the Internet. If SMTP is disabled or not configured on your EC2 instance, your site cannot send emails reliably.

By default, EC2 instances do not have an email service configured, which means relying on PHP’s mail function won’t work since there’s no email server available. This often leads to emails being lost or never sent in the first place.

2. Misconfigured Plugin Notification Settings

Sometimes, the issue lies within your WordPress plugin settings. If the notification settings in your contact form or e-commerce plugin are not correctly configured, your emails might not be sent. This can happen if the plugin is set to use an incorrect email address or if it is not properly integrated with your site’s email configuration.

3. Spam Filters are Catching Emails

Even if your WordPress site sends emails, they might not reach the recipient’s inbox due to spam filters. This often happens when emails are sent without proper authentication. Many email services use spam filters to block unauthenticated emails, which means your WordPress emails might end up in the recipient’s spam folder or be rejected outright.

Therefore, configuring email domain authentication methods such as SPF, DKIM, and DMARC is crucial to ensuring your emails are trusted by receiving mail servers.

4. AWS EC2 Email Sending Limitations

AWS imposes email-sending limitations on EC2 instances, particularly on port 25, which is commonly used for SMTP. If your instance is restricted, you might find it difficult to send emails. While you can request AWS to lift these limitations, it’s important to remember that emails sent from your instance might still get flagged as spam if not properly authenticated.

In this case, using a dedicated SMTP service or Amazon SES (Simple Email Service) can help bypass these limitations and improve deliverability.

These are the primary reasons why WordPress is not sending emails on AWS EC2. Next, let’s go through the steps to fix this issue.

3 Easy Steps to Fix WordPress Not Sending Email on AWS EC2

To resolve the issue of WordPress not sending emails on AWS EC2, we’ll set up the Post SMTP plugin that handles email delivery for your WordPress site.

As we told you earlier, the root cause of WordPress not sending emails is the WordPress `wp_mail` function, which depends on PHP’s mail function. We will use the Post SMTP plugin to fix this issue.

What is Post SMTP?

Post SMTP is a WordPress plugin that improves email deliverability by replacing the default `wp_mail` function with an SMTP server. Post SMTP supports various SMTP mailers, including Gmail SMTP Server, Microsoft 365, Amazon SES, Zoho Mail, SendGrid, Brevo, etc.

Let’s go through the three easy steps to set up the Post SMTP plugin and fix the email issue.

Step #1: Install and Activate the Post SMTP Plugin

  • Log in to your WordPress dashboard.
  • Navigate to Plugins → Add New.
  • In the search box, type “Post SMTP” and press Enter.
  • Look for “Post SMTP — WordPress SMTP Plugin” by Post SMTP and click Install Now.
  • Once the installation is complete, click Activate.
Post SMTP WordPress SMTP Plugin

Step #2: Configure and Test Your SMTP Mailer

  • After activation, you’ll be prompted to begin the setup wizard. Click the Start the Wizard button.
  • First, select your SMTP mailer (e.g., Gmail, Microsoft 365, Brevo, etc.) from the list of available options.
Test Your SMTP Mailer
  • Click Continue and enter your sender details, including the From Email and From Name fields.
  • Provide the API Key or SMTP credentials for your chosen mailer to authenticate your account.
Test your SMTP configuration
  • Click Save and Continue to proceed.
  • Once you have authenticated, you can test your SMTP configuration. To send a test email, enter a valid “Recipient Email Address.” and click “Send Test Email.”
Send Test Email
  • You will see a green “Congratulations :)” message if the test email is successful.
  • To end the setup process, click the “Finish” button.

Step #3: Force From Email Address for All Emails

  • Go to Post SMTP → Settings from your WordPress dashboard.
  • Click on the Message tab.
  • In the Email Address field, enter the email address you want to use as the default ‘From’ address for all outgoing emails.
  • Tick the box that says, “Prevent plugins and themes from changing this.”
Force From Email Address
  • Scroll down and click Save Changes to update your settings.

That’s it. By now, the ‘WordPress Emails Not Sending on AWS EC2’ issue should be fixed. In any case, if the issue persists, we recommend you set up email authentication protocols for your email domain.

Don’t Forget to Set Up DNS Records for Your Email Domain

To maximize email deliverability, it’s crucial to configure DNS records (SPF< DKIM, and DMARC) for your domain. These records help verify the legitimacy of your emails, which reduces the likelihood that spam filters will mark them as spam.

  • SPF (Sender Policy Framework): SPF records specify which mail servers are authorized to send emails on behalf of your domain.
  • DKIM (DomainKeys Identified Mail): DKIM adds a digital signature to your emails, ensuring they haven’t been tampered with during transit.
  • DMARC (Domain-based Message Authentication, Reporting, and Conformance): This DNS record works with SPF and DKIM to provide an additional layer of security, which helps prevent email spoofing.

To learn more, check out the SPF, DKIM, and DMARC guide for detailed explanation.

If you need any help, click here for expert assistance. We can help you set up these DNS records so that your emails reach the recipient’s inbox reliably.

Final Remarks on WordPress Not Sending Email on AWS

Fixing WordPress email issues on AWS EC2 requires a methodical approach to achieve reliable delivery. You can significantly improve your email deliverability by installing the Post SMTP plugin, configuring your SMTP settings, and setting up DNS records like SPF, DKIM, and DMARC. These steps help avoid typical email delivery issues, such as emails going to spam or not being sent at all.

Remember, if you encounter any issues during this process, don’t hesitate to contact us. Our team of WordPress experts is always ready to help you with all your WordPress email-related issues.