Skip to content

Email

WordPress environments on the VIP Platform are configured to route transactional email (e.g., password reset and user registration notifications) through Automattic’s mail servers. By default, transactional emails are sent from the email address donotreply@wpvip.com.

The WordPress wp_mail() function can be used in custom code to send small amounts of emails to admins or other specific email addresses. But to prevent issues with spam, abuse, or other unwanted communications, any custom code using  wp_mail() should not generate (or allow users to generate) email messages to site users or user-supplied email addresses.

Limitations

  • VIP’s infrastructure for message delivery is not intended for the distribution of HTML emails, mailing list functionality, invitations to view or share content, notifications of site activity, or other messages generated in bulk. A third-party SMTP (Simple Mail Transfer Protocol) service or ESP (Email Service Provider) should be used for these purposes, and can be integrated with a plugin or custom code.
  • The sending size limit through Automattic’s mail servers is 100MB (after encoding).
  • The email address of the sender cannot be modified for emails that are sent by the Jetpack Subscription feature.

External email service providers

To send emails in large quantities, or to send email from a custom domain, an external SMTP server or ESP should be used. To ensure that a domain’s sender reputation stays positive, and to help prevent emails from being flagged as spam, be sure to configure DKIM (DomainKeys Identified Mail), SPF (Sender Policy Framework), and correctly configure a domain’s DNS records as per the email provider documentation.

Most email service providers have WordPress plugins that allow their service to be integrated with a WordPress site. External email service providers can also be integrated with a site on the VIP Platform via custom code that hooks directly into the phpmailer_init hook which is also used by VIP’s Automattic mail server integration. For additional guidance and code examples for this type of integration, refer to PHPMailer’s wiki.

Customize the email address of the sender

The default sender’s email address donotreply@wpvip.com can be overridden and updated to a different, custom email address with an SMTP plugin or with custom code.

SMTP and email service provider plugins

Most email service providers have WordPress plugins that allow their service to be integrated with a WordPress site. Email service provider plugins often provide the option to alter the sender’s email address, and other email sending behavior by using the service provider instead of the web server. Customers who use an external email service should evaluate plugin candidates for these service integrations before enabling them in a production environment.

Custom code

Use the wp_mail_from filter to programmatically customize the email address of the sender to something other than the default donotreply@wpvip.com. When using this filter, the priority must be set to a value greater than 1 to override the default configuration of the sender’s email address in the VIP MU plugins.

This code example demonstrates the use of the wp_mail_from filter to update the default sender’s email address to the custom value user@example.com:

add_filter( 'wp_mail_from', function( $from ) {
    return 'user@example.com';
}, 15 );

Enable uploaded files to be sent as attachments

Media files that are uploaded to a WordPress site are not stored on the web container’s filesystem. Instead, uploaded files are stored in the VIP File System which is a separate object store. To send a file stored in the VIP File System as an attachment in an email, the VIP constant USE_VIP_PHPMAILER must be defined as true invip-config.php.

/vip-config/vip-config.php
define( 'USE_VIP_PHPMAILER', true );

Prevent email from being marked as spam

It is possible for emails sent from a WordPress site on VIP to be marked as spam on the receiving end. To prevent this, an SPF for Automattic’s mail servers should be added to the DNS of a site’s domain. An SPF record enables a domain to state that Automattic’s mail servers can send emails on its behalf.

Update a domain’s DNS with the domain’s DNS provider to include this SPF record for Automattic’s mail servers: _spf.automattic.com.

If a range of IPs is required for the SPF record, they can be retrieved by running this command in a local machine’s terminal:

dig txt +short _spf.automattic.com

Email logs

Customers can optionally add an email log plugin to have more visibility into outgoing emails. Email log plugins often provide the ability to verify that an email has been sent, where it has been set, when it was sent, and its content. When considering plugin candidates for an email log plugin, follow the guidelines for evaluating a third-party plugin before adding or enabling the plugin in a production environment.



Last updated: August 03, 2023

Relevant to

  • WordPress