mailenv
W
Integration guide

MailEnv + WordPress

By default, WordPress sends mail through your web server. It is often unauthenticated and often lands in spam. Route wp_mail through MailEnv and password resets, order emails, and form notifications go out authenticated from your own domain.

wp-content/mu-plugins/mailenv.php
// Send every wp_mail() through MailEnv (WP 5.7+)
add_filter('pre_wp_mail', function ($null, $atts) {
  $res = wp_remote_post('https://api.mailenv.com/v1/send', [
    'headers' => [
      'Authorization' => 'Bearer ' . MAILENV_KEY,
      'Content-Type'  => 'application/json',
    ],
    'body' => wp_json_encode([
      'from'    => 'hello@acme.com',
      'to'      => (array) $atts['to'],
      'subject' => $atts['subject'],
      'html'    => $atts['message'],
    ]),
  ]);
  return !is_wp_error($res);
}, 10, 2);
What you can do

Stop losing WordPress mail to spam folders.

Password resets that arrive

Login and account mail sent with proper authentication instead of from an unauthenticated server.

WooCommerce orders

Order, refund, and shipping emails sent through protected SES delivery.

Form notifications

Contact form and lead alerts that actually reach your team's inbox.

How to connect

Set it up in a few minutes.

You'll need a MailEnv API key and a verified sending domain.

Same guardrails, whatever triggers the send.

Mail sent from WordPress goes through the same authentication, suppression, and throttling as mail sent from your own code. Suppressed or unverified addresses are blocked no matter where the request comes from.

  1. 1 Add your API keyDefine MAILENV_KEY in wp-config.php. Keep it out of the database and out of version control.
  2. 2 Drop in the mu-pluginAdd the snippet as a must-use plugin so it can't be switched off by accident. Every wp_mail() call then goes through MailEnv.
  3. 3 Verify your domainSend from your site's domain with SPF, DKIM, and DMARC aligned, then send a password reset to test.

More integrations

WordPress is a trademark of its owner. This guide shows how to connect WordPress to MailEnv through its standard webhook and HTTP features. It does not describe an official partnership.

Send critical mail from WordPress, protected.

Get an API key, verify your domain, and connect WordPress in minutes. Need a hand? We'll help you set it up.