Skip to main content
Last Reviewed: November 02, 2020

Use WP Mail SMTP to Send Email with SendGrid

Learn how to configure WP Mail SMTP for use with SendGrid.


This section provides information on how to configure WP Mail SMTP to work with SendGrid.

SendGrid is a popular email service, but its WordPress plugin has been deprecated as of July 13, 2021.

This guide will cover how to install and configure WP Mail SMTP to send emails from your WordPress site using SendGrid. This plugin will ensure that the SMTP host credentials are correctly configured, so that emails are sent successfully.

Info:
Note

WP Mail SMTP is not the only plugin available to integrate WordPress with SendGrid, nor is it officially endorsed by Pantheon as the preferred method.

Before You Begin

This guide assumes a pre-existing configuration of:

  • A configured WordPress site. Refer to our Getting Started guide if you need to set up a new WordPress site on Pantheon.
  • A familiarity with the WebOps workflow, as steps involve moving code and content between environments.
  • A SendGrid account and API key. Follow the steps in Create a SendGrid Account to create and authenticate an account.
  • If your site has access to Multidev, we suggest creating a new Multidev environment to work in. If so, substitute the Multidev name for dev in the guide below, unless otherwise noted.

Install the WP Mail SMTP Plugin

There are several ways to install and manage WordPress plugins on Pantheon. This guide will cover installation from the WordPress Admin Dashboard, and from the command line using Terminus and WP-CLI.

Each method requires first setting your working environment (Dev or a Multidev environment) to SFTP mode.

Install from the WordPress Admin Dashboard

  1. Navigate to the Site Dashboard, select the Dev (or Multidev) environment, and click the Site Admin button. Log in to your WordPress Admin Dashboard.

  2. Select Plugins, then select Add New

    The WordPress Admin Dashboard, highlighting the Plugins page and Add New button

  3. Enter "wp mail smtp" in the search box, locate WP Mail SMTP by WPForms and click Install Now:

    The Add Plugins search view

  4. Click Activate when the installation finishes.

WP Mail SMTP is now installed! You can continue to Configure WP Mail SMTP for SendGrid.

Install with Terminus

Code:
Exports

When using Terminus, we suggest defining the variables $site and $env in your terminal session to match your site name and the Dev (or Multidev) environment:

export site=yoursitename
export env=dev #Or a multidev name
  1. Confirm that the environment is in SFTP mode:

    terminus connection:set $site.$env sftp
    [notice] The connection mode is already set to sftp.
  2. Invoke WP-CLI over Terminus to install and activate WP Mail SMTP:

    terminus wp $site.$env -- plugin install --activate wp-mail-smtp
    Warning: Permanently added '[appserver.sendgridsmtp.0e1f236a-....drush.in]:2222,[35.223.224.107]:2222' (RSA) to the list of known hosts.
    Installing WP Mail SMTP by WPForms (2.5.1)
    Warning: Failed to create directory '/.wp-cli/cache/': mkdir(): Read-only file system.
    Downloading installation package from https://downloads.wordpress.org/plugin/wp-mail-smtp.2.5.1.zip...
    Unpacking the package...
    Installing the plugin...
    Plugin installed successfully.
    Activating 'wp-mail-smtp'...
    Plugin 'wp-mail-smtp' activated.
    Success: Installed 1 of 1 plugins.
    [notice] Command: anita-wordpress.sendgridsmtp -- wp plugin install wp-mail-smtp [Exit: 0]

Configure WP Mail SMTP for SendGrid

  1. Navigate to the WordPress Admin Dashboard's Plugins Page, locate WP Mail SMTP, and click Settings.

  2. Select the General tab, and provide values for "From Email" and "From Name" the Mail section.

  3. Select SendGrid in the Mailer subsection:

    The plugins settings page for WP Mail SMTP

  4. Navigate to the next section, then paste in your API key, and then select Save Settings.

  5. Confirm your settings are correct: select the Email Test tab and send a test email to yourself. Be sure to check your spam folder for the test message.

Congratulations, you've configured WP Mail SMTP for SendGrid!

More Resources