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.
For full installation instructions, see our Email Made Easy WordPress Plugin setup guide.
You do need to have an SMTP2GO account to use the plugin, so if you are not an existing customer, you will need to create an account here: https://www.smtp2go.com/
More information on WordPress’s wp_mail() function
The information below is a quick summary of the wp_mail() function for those who are interested in learning more about it.
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 shows 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@example.com', 'test2@example.com', 'Test 3 <address3@example.com>');
$headers = array();
$headers[] = 'From: Me <me@company.com>';
$headers[] = 'Cc: test4@example.com';
$headers[] = 'Bcc: test5@example.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');