• WordPress

The Easiest Way to Send Emails Using WordPress – A Step-By-Step Guide

  • Veljko Ristić
  • 9 min read
The Easiest Way to Send Emails Using WordPress – A Step-By-Step Guide

Intro

WordPress utilizes the Hypertext Preprocessor (PHP) mail() function for its email feature. Unfortunately, this isn't the most reliable tool, as it could potentially activate spam filters and create error notifications for its users.

WordPress website owners who regularly correspond with their visitors should consider using the Simple Mail Transfer Protocol (SMTP) server. This offers a secure and dependable way to send emails, but it is not an easy way.

In this article, we're going to dive into the world of sending emails using WordPress. We'll cover everything from the basics of setting up email to sending custom email templates, troubleshooting email-sending issues, sending bulk emails, and integrating email validation plugins.

I also give you some practical tips to help you get the most out of your email marketing campaigns. Whether you're a marketer, advertiser, or business owner, this article has got you covered!

Setting up Email on WordPress

As I already wrote in the intro of the article, WordPress has a default email function that lets you send emails directly from your website. However, this function has some limitations, such as low deliverability rates and limited customization options.

How to send emails from WordPress using wp_mail() function?

Sending emails from WordPress using the wp_mail() function is a straightforward process. Here are the steps you need to follow:

  • Firstly, navigate to the functions.php file in your WordPress theme or child theme.
  • Add the following code to create a function that sends an email:

function send_email() {
    $to = '[email protected]';
    $subject = 'Test Email';
    $message = 'This is a test email sent from WordPress using the wp_mail() function.';
    $headers = 'From: Your Name <[email protected]>';

    wp_mail( $to, $subject, $message, $headers );
}
  • Replace the email address in the $to variable, subject line in $subject variable, message body in $message variable, and sender details in the $headers variable with your own information.
  • Save the functions.php file.
  • Finally, add the following code to any page or post:

<button onclick="send_email()">Send Email</button>

This will add a button to your page or post that, when clicked, will trigger the send_email() function and send the email.

Note: Before sending emails using the wp_mail() function, make sure that your WordPress site is correctly configured to send emails. You can check your email settings in the WordPress dashboard under Settings > General > Email Address. Additionally, some web hosts may have restrictions on sending emails, so it's always a good idea to check with your web host to ensure that email sending is allowed.

But don't worry, you can still make the most out of your email marketing campaigns by configuring WordPress to send emails through an email provider or SMTP.

The first step is to choose an email provider. While popular email providers like Gmail and Outlook are an option, it's recommended that businesses use a professional email provider like G Suite, Office 365, or Zoho Mail for better deliverability rates and branding options.

Once you have an email provider, the next step is to set up SMTP on WordPress. This protocol allows you to send emails through a dedicated email server, giving you better control over email deliverability rates and customization options. To set up SMTP on WordPress, you'll need to install a plugin that supports SMTP, like WP Mail SMTP or Easy WP SMTP. These plugins will let you configure your email settings and SMTP credentials, such as host, port, and authentication.

How to install a plugin that supports SMTP?

Installing a plugin that supports SMTP on WordPress is a quick and easy process. Here's how you can do it:

  1. Start by logging in to your WordPress dashboard.
  2. Next, click on the "Plugins" menu item and select "Add New" from the dropdown.
  3. In the search bar, type in the name of the SMTP plugin you want to install (such as WP Mail SMTP or Easy WP SMTP).
  4. Once you find the plugin you want to install, click on the "Install Now" button next to it.
  5. Wait for the plugin to install, and then click on the "Activate" button to activate the plugin.

How to configure your email settings and SMTP credentials?

After you've installed and activated the SMTP plugin, you'll need to configure your email settings and SMTP credentials. Here's how:

  1. Go to the "Settings" menu item in your WordPress dashboard.
  2. Click on the "Email" tab.
  3. Choose the "SMTP" option.
  4. Enter your SMTP host, port, and authentication details (usually provided by your email provider).
  5. Save the changes.

Once you've completed these steps, you can test your email-sending function by sending a test email. If everything is working correctly, you should receive the email in your inbox.

Sending Custom Email Templates

Creating custom email templates is a great way to add a personal touch to your emails and make them more appealing to your subscribers. WordPress offers various plugins and coding options to design and send custom email templates with ease.

Meet Ranktracker

The All-in-One Platform for Effective SEO

Behind every successful business is a strong SEO campaign. But with countless optimization tools and techniques out there to choose from, it can be hard to know where to start. Well, fear no more, cause I've got just the thing to help. Presenting the Ranktracker all-in-one platform for effective SEO

We have finally opened registration to Ranktracker absolutely free!

Create a free account

Or Sign in using your credentials

One popular plugin for creating custom email templates on WordPress is WP HTML Mail. It offers a drag-and-drop editor that simplifies the process of designing and sending custom email templates. Another option is to create your email templates using HTML and CSS and send them through WordPress using a plugin like Postman SMTP.

It's important to keep some best practices in mind when designing custom email templates. Keeping the design simple and professional, using a clear and concise subject line, personalizing the email with the recipient's name, including a clear call-to-action, and optimizing the email for mobile devices are some key factors to consider.

How to create email templates using HTML and CSS

Creating custom email templates using HTML and CSS requires some knowledge of coding, but it can be a great way to create unique and professional-looking emails for your subscribers. Here are the basic steps to create email templates using HTML and CSS:

Plan out the design: Before you start coding, it's a good idea to plan out the design of your email template. Think about what elements you want to include, such as your logo, text, buttons, and images in WordPress. Sketch out a rough layout of your design, so you have a clear idea of what you want to create.

Write the HTML code: Once you have a plan in place, you can start writing the HTML code for your email template. This involves creating the structure of your email, including the header, body, and footer. Use HTML tags to format the text, add images, and create links.

Style the email with CSS: After you have written the HTML code, you can add CSS styling to make the email look more professional. Use CSS to change the font, colors, and layout of your email template. Be sure to use inline styles instead of external style sheets, as some email clients do not support external stylesheets.

Use my code to create your basic template:


<!DOCTYPE html>
<html>
  <head>
    <meta charset="utf-8">
    <title>My Custom Email Template</title>
    <style>
      /* CSS styles go here */
      body {
        font-family: Arial, sans-serif;
        background-color: #f5f5f5;
        padding: 0;
        margin: 0;
      }
      .header {
        background-color: #333;
        color: #fff;
        padding: 20px;
        text-align: center;
      }
      .content {
        padding: 20px;
        font-size: 16px;
        line-height: 1.5;
        color: #333;
      }
      .button {
        display: inline-block;
        background-color: #008000;
        color: #fff;
        padding: 10px 20px;
        text-decoration: none;
        border-radius: 5px;
        margin-top: 20px;
      }
    </style>
  </head>
  <body>
    <div class="header">
      <h1>My Custom Email Template</h1>
    </div>
    <div class="content">
      <p>Hello [Recipient's Name],</p>
      <p>Thank you for subscribing to our newsletter. Here's some information about our latest product:</p>
      <ul>
        <li>Product name: [Product Name]</li>
        <li>Description: [Product Description]</li>
        <li>Price: [Product Price]</li>
      </ul>
      <a href="[CTA Link]" class="button">Buy Now</a>
      <p>Thank you for your support.</p>
      <p>Best regards,</p>
      <p>The My Custom Email Team</p>
    </div>
  </body>
</html>

Note: Some email clients may not support certain CSS properties, so it's best to keep the design simple and test the email template across different email clients before sending it to your subscribers.

Test the email template: Before you send out your email, it's important to test it to make sure it looks and functions as intended. Send a test email to yourself or a colleague and check to make sure all the such as broken links and buttons work correctly, and that the email looks good on different devices and email clients.

Meet Ranktracker

The All-in-One Platform for Effective SEO

Behind every successful business is a strong SEO campaign. But with countless optimization tools and techniques out there to choose from, it can be hard to know where to start. Well, fear no more, cause I've got just the thing to help. Presenting the Ranktracker all-in-one platform for effective SEO

We have finally opened registration to Ranktracker absolutely free!

Create a free account

Or Sign in using your credentials

Save the template: Once you have tested your email template and are happy with the design and functionality, save it as a reusable template in your email marketing software or in your WordPress email plugin.

Troubleshooting Email Sending Issues

If you're having trouble with sending emails through WordPress, don't worry, you're not alone. Some common issues with WordPress email sending include emails not being delivered, ending up in spam folders, or not being sent to certain email addresses. But there are steps you can take to troubleshoot these issues.

First, check your email settings on WordPress to make sure they are configured correctly.

To check your email settings on WordPress, you can simply follow these steps:

  • Log in to your WordPress dashboard.
  • Click on the "Settings" menu item.
  • Click on the "General" tab.
  • Scroll down to the "Email Address" field and make sure it is correct.
  • Scroll down to the "Membership" and "New User Default Role" fields and make sure they are also correct.

Then, double-check your email server settings, including DNS settings and email authentication, to ensure they are also configured correctly.

As for checking your email server settings, including DNS settings and email authentication, it's best to reach out to your email provider or hosting company for assistance. They can provide you with the necessary information to configure your email settings correctly.

Additionally, you should check the recipient's spam folder to make sure your email wasn't accidentally marked as spam. If none of these steps help, contact your email provider to make sure they are not blocking the email.

If you're concerned that your email may have been marked as spam, you can simply ask the recipient to check their spam folder. If they find your email in their spam folder, they should mark it as "not spam" to help prevent future emails from being marked as spam. This is important to maintain good email deliverability rates and ensure that your emails are being delivered to your subscribers' inboxes.

It can also happen to clash between two plugins that are very alike. Take, for instance, SMTP and contact form plugins, which could find themselves in opposition with other similar plugins to the point where emails can't be sent. Unfortunately, there is no simple answer to this, since the only way to solve it is to deactivate all the plugins, then turn them on one by one and check if emails can be sent again.

To maintain good email deliverability rates, follow best practices such as using a professional email provider, avoiding spam trigger words and phrases in email content, keeping a clean email list by regularly removing inactive or invalid email addresses, using double opt-in to ensure subscribers have given explicit consent to receive emails, and monitoring email deliverability rates and adjusting your email content and strategy as needed.

By following these best practices and troubleshooting steps, you can maintain good email deliverability rates and ensure your emails are delivered to your subscribers' inboxes.

Sending Bulk Emails on WordPress

Sending bulk emails can be a great way for businesses to reach numerous subscribers at once. On WordPress, there are plugins available that offer features such as segmentation, personalization, and automation to make the process even easier.

One popular plugin for sending bulk emails is Sendinblue. With features like email templates, list management, and marketing automation, it can help businesses create effective and engaging email campaigns. Another option is MailPoet, which allows businesses to create and send newsletters or email surveys directly from their WordPress site.

To ensure that your bulk emails are effective and avoid being marked as spam, it's important to follow some best practices. These include segmenting your email list to send targeted and personalized messages, using clear and concise subject lines, optimizing your emails for mobile devices, including a clear call-to-action, and avoiding trigger words and phrases that may cause your email to be flagged as spam.

Meet Ranktracker

The All-in-One Platform for Effective SEO

Behind every successful business is a strong SEO campaign. But with countless optimization tools and techniques out there to choose from, it can be hard to know where to start. Well, fear no more, cause I've got just the thing to help. Presenting the Ranktracker all-in-one platform for effective SEO

We have finally opened registration to Ranktracker absolutely free!

Create a free account

Or Sign in using your credentials

Don't forget to test your emails before sending them to ensure they display correctly and are error-free.

Email Validation Plugins

There are a bunch of email validation plugins available on WordPress to integrate into your site. One of the most popular plugins is Clearout, which offers features like email verification, list cleaning, and real-time email validation.

To get started with integrating an email validation plugin into WordPress, it's as easy as 1-2-3:

  1. Install the email validation plugin from the WordPress plugin directory.
  2. Configure the plugin settings to meet your business needs.
  3. Use the plugin to validate email addresses in bulk or in real-time.

Some other great email validation plugins for WordPress include ZeroBounce and Email Validator. These plugins offer features similar to Clearout and help businesses ensure that their messages are reaching real email addresses.

So, go ahead and give it a try!

Sum Up

By incorporating the best practices discussed in this article, businesses can increase their email deliverability rates, reduce bounce rates, and enhance their email marketing campaigns. It's important to note that maintaining good email deliverability requires ongoing effort, such as regular list cleaning and email validation.

In summary, WordPress provides a range of tools and plugins that businesses can leverage to optimize their email marketing efforts. By utilizing these resources and following best practices, businesses can effectively connect with their customers and subscribers, and drive engagement and revenue.

Veljko Ristić

Veljko Ristić

Content Manager

Linguist by trade, digital marketer at heart, I’m a Content Manager who’s been in the online space for 10+ years. From ads to e-books, I’ve covered it all as a writer, editor, project manager, and everything in between. Now, my passion is with email infrastructure with a strong focus on technical content and the cutting-edge in programming logic and flows. But I still like spreading my gospels while blogging purely about marketing.

Start using Ranktracker… For free!

Find out what’s holding your website back from ranking.

Create a free account

Or Sign in using your credentials

Different views of Ranktracker app