Skip to content

Send emails from a custom domain

By default, transactional emails (e.g., password resets, user registration notifications) are sent from the email address donotreply@wpvip.com. The default sender’s email address can be overridden with an SMTP plugin or custom code to send emails from a custom domain instead.

Prerequisite

To send emails from a custom domain:

Override the default sender’s email address with custom code

Use the wp_mail_from filter to programmatically override the default sender’s email address donotreply@wpvip.com to an email address of a custom domain that has the required DNS records.

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

Send bulk email from a custom domain

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 that are generated in bulk. For these types of emails, a Simple Mail Transfer Protocol (SMTP) server or an Email Service Provider (ESP) should be used instead.

A third-party SMTP server or ESP can enable large quantities of email to be sent from a custom domain.

Prerequisite

To send emails in large quantities from a custom domain:

Integrate an SMTP server or ESP

An external SMTP server or ESP can be integrated with a plugin or custom code.

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.

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.

Last updated: November 07, 2024

Relevant to

  • WordPress