SMTP2GO WordPress Plugin

SMTP2GO’s WordPress plugin replaces the default WordPress wp_mail() function and, once enabled, all outgoing mail sent through your WordPress installation will be sent via our servers. Should you run into any issues, our fantastic support team are on hand for setup assistance. 


Install SMTP2GO’s Plugin

  1. From your WordPress site’s Admin Panel navigate to Plugins > Add New.
  2. Enter smtp2go in the Search Plugins text field and press Enter.
  3. Your search results will include a plugin named SMTP2GO.
  4. Click the Install Now button.
  5. Upon successful installation, the SMTP2GO plugin will appear in Plugins > Installed Plugins.
  6. Finally, click Activate Plugin to activate your new plugin.

Once successfully activated, the SMTP2GO plugin will appear in the ‘Settings’ menu in the WordPress Admin Panel. Click on ‘Settings > SMTP2GO’ to open the plugin configuration page.

If you are not an existing customer, you will need to create an SMTP2GO account here:
https://www.smtp2go.com/


Configuration

You will need to enable the plugin and enter the required details under the ‘Settings’ tab. 

  1. Enable the checkbox Send email using SMTP2GO to send email through the SMTP2GO plugin. 
  2. Enter an API Key which you obtain from your SMTP2GO account’s Settings > API Keys section.
    Note: the API Key needs at least the following permissions:
    Emails and Statistics.
  3. Set the From Email Address
  4. Set the From Name
  5. Save the settings by clicking the ‘Save Settings’ button at the bottom.

Note: The default From Email Address and From Name can be changed programmatically.

You can add custom headers to your emails, such as headers for custom tracking with third-party tools such as X-Campaign.

The ‘Test’ tab can be used to send a test email to ensure your configuration is correct.

The ‘Stats’ tab will give you an overview of your SMTP2GO plan’s quota as well as your Spam and Bounce rates for the past 30 days. 

Screenshot_1.jpg 

And that's it! Once you've installed and enabled the plugin, all emails originating from your WordPress installation will be routed via your SMTP2GO account.

The information below is a quick summary of the wp_mail() function for those who are interested in learning more about it.

 

More information on WordPress’s wp_mail() function

The SMTP2GO plugin makes adjustments to the wp_mail() function so that all emails sent from WordPress are delivered by SMTP2GO. 

wp_mail($to, $subject, $message, $headers ="", $attachments = array())

If you need to send an email with HTML content, set the content type to 'text/html' by running the following function before wp_mail():

add_filter('wp_mail_content_type', 'set_html_content_type');

After you’ve run wp_mail(), you must remove the ‘text/html’ filter in order to return to your initial settings and failing to do so could lead to unexpected problems with e-mails from WordPress or plugins/themes.

remove_filter('wp_mail_content_type', 'set_html_content_type');

Example:

add_filter('wp_mail_content_type', 'set_html_content_type');
wp_mail($to, $subject, $message, $headers ="", $attachments = array())
remove_filter('wp_mail_content_type', 'set_html_content_type');

 

The example below show an HTML email being sent using wp_mail(), using an array to set headers.

$subject = 'SMTP2GO test';
$message = 'Sent using SMTP2GO’s WordPress plugin';
$to = array('test1@smtp2go.com', 'test2@smtp2go.com', 'Test 3 <address3@smtp2go.com>');
$headers = array();
$headers[] = 'From: Me <me@example.com>';
$headers[] = 'Cc: test5@smtp2go.com';
$headers[] = 'Bcc: test6@smtp2go.com';
$attachments = array('/tmp/img1.jpg', '/tmp/img2.jpg');
add_filter('wp_mail_content_type', 'set_html_content_type');
$mail = wp_mail($to, $subject, $message, $headers, $attachments);
remove_filter('wp_mail_content_type', 'set_html_content_type');



Was this article helpful?

...