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 WPVIP’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 WPVIP’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.

Limitations specific to sending emails from custom domains

  • The domain must be added to the environment’s Domains & TLS panel in the VIP Dashboard. If the domain is being added solely for the purpose of sending emails, only the updates outlined in DNS record requirements are needed.
    • If the www variant of a domain is added to an environment’s Domains panel, both the www or the non-www variant of the domain can be used for sending email as long as the domain that will be used meets the DNS record requirements.
    • If the non-www variant of a domain is added to an environment’s Domains panel, only the non-www variant of the domain can be used for sending email as long as that domain meets the DNS record requirements.
  • The domain’s DNS records must be updated with the SPF and DKIM setting values as outlined in DNS record requirements. Emails sent in large quantities from custom domains also require DMARC setting values.
  • After adding a custom domain to an environment’s VIP Dashboard, at least 12 hours must elapse before it can be used to send emails.
  • After updating a custom domain’s DNS settings with the DNS record requirements , at least 12 hours must elapse before the updated settings can be detected and allow for the domain to be used to send emails.

DNS record requirements

If emails are configured to be sent with a custom domain, SPF and DKIM records must be added to the DNS records for that domain.  

SPF record

A Sender Policy Framework (SPF) record identifies the mail servers and domains that are allowed to send email on behalf of a domain.

Adding SPF records for Automattic’s mail servers to the DNS records of the custom domain helps prevent emails sent from a WordPress site on VIP using a custom email address from being marked as spam on the receiving end.

SPF record value:

include:_spf.wpvip.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.wpvip.com

DKIM record

A DomainKeys Identified Mail (DKIM) record stores the public key used to verify the authenticity of the email sent from the custom domain. For most DNS providers, these settings are assigned to the TXT DNS record type.

Substitute <custom_domain> where it appears with the actual custom domain (i.e. update wpvip1._domainkey.<custom_domain> to wpvip1._domainkey.example.com).

DKIM record values:

wpvip1._domainkey.<custom_domain> CNAME wpvip1._domainkey.wpvip.com
wpvip2._domainkey.<custom_domain> CNAME wpvip2._domainkey.wpvip.com

DMARC record

A Domain-based Message Authentication, Reporting and Conformance (DMARC) record must also be added to the domain’s DNS settings if more than 5,000 emails are sent per day from the custom domain. For most DNS providers, these settings are assigned to the TXT DNS record type.

Substitute <custom_domain> where it appears with the actual custom domain (i.e. update _dmarc.<custom_domain> to _dmarc.example.com).

DMARC host value:

_dmarc.<custom_domain>

DMARC TXT value:

v=DMARC1; p=none;

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. 

Prerequisite

To send emails in large quantities from a custom domain:

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

Custom code or an SMTP plugin can be used to override the default sender’s email address (donotreply@wpvip.com) and send emails from a custom domain instead.

Prerequisite

To send emails from a custom domain:

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 );

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.

Disable email

Use the vip_block_wp_mail filter to disable all outgoing emails from a WordPress site, including transactional emails (e.g., password reset and user registration notifications).

To disable emails, add the following code to a file in /client-mu-plugins:

/client-mu-plugins/file.php
add_filter( 'vip_block_wp_mail','__return_true' );



Last updated: February 15, 2024

Relevant to

  • WordPress