WP Manifestindependent plugin directory
manifest / email / acs-mailer-plugin

ACS Mailer

This plugin ensures that all emails generated by WordPress (notifications, password resets, WooCommerce emails, etc.) are routed through ACS for reliability and deliverability.

by Lawal Yusuf · github.com/lawalyusuf/acs-mailer-plugin · website

0stars
0forks

Install

No release zip yet. The repository archive installs, but the folder name will carry the branch suffix and updates will not flow:

wp plugin install https://github.com/lawalyusuf/acs-mailer-plugin/archive/refs/heads/main.zip

ACS Mailer (mu-plugin)

A WordPress must-use plugin (mu-plugin) that overrides wp_mail() to send emails using Azure Communication Services (ACS) Email API instead of the default PHP mail function.

This plugin ensures that all emails generated by WordPress (notifications, password resets, WooCommerce emails, etc.) are routed through ACS for reliability and deliverability.


Features

  • Overrides the native wp_mail() function in WordPress.
  • Sends transactional emails securely via Azure Communication Services (ACS).
  • Works seamlessly without modifying your existing WordPress email calls.
  • Lightweight and requires no external dependencies.

Installation

1. Copy acs-mailer Plugin to mu-plugins

  1. In your WordPress root, locate the folder inside wp-content

    If mu-plugins doesn’t exist, create it (wp-content/mu-plugins)

  2. Save the acs-mailer.php file inside this directory. WordPress automatically loads all mu-plugins without activation from the admin dashboard.

2. Configure Environment Variables

The plugin requires ACS credentials to work. These can be set either in wp-config.php or in a .env file if you are using something like vlucas/phpdotenv.

Option A: wp-config.php

Add the following lines before /* That's all, stop editing! Happy publishing. */:

// Azure Communication Services (ACS) Email Settings
define('ACS_ENDPOINT', 'https://<your-resource-name>.communication.azure.com');
define('ACS_ACCESS_KEY', '<your-acs-access-key>');
define('ACS_API_VERSION', '2023-03-31');
define('ACS_SENDER', '<your-verified-sender@domain.com>');

ACS_ENDPOINT → Your ACS resource endpoint (https://<resource>.communication.azure.com).

ACS_ACCESS_KEY → Access key from ACS resource (Base64 encoded).

ACS_API_VERSION → Currently supported version: 2023-03-31.

ACS_SENDER → The sender email address verified in ACS.

Option B: .env


If you are using an .env loader in WordPress, you can add:

ACS_ENDPOINT=https://<your-resource-name>.communication.azure.com
ACS_ACCESS_KEY=<your-acs-access-key>
ACS_API_VERSION=2023-03-31
ACS_SENDER=<your-verified-sender@domain.com>

Test Email Sending

WordPress will now automatically use ACS for all emails.

You can test by:

Resetting your password in WordPress (wp-login.php?action=lostpassword).

Using a plugin like WP Mail Logging to verify mail attempts.

Check your server error log if an email fails:

ACS mail send failed: Array ( ... )

How It Works

  • Hooks into WordPress pre_wp_mail filter.

  • Intercepts all outgoing mail requests.

  • Formats payload to ACS Email API schema.

  • Signs request with HMAC-SHA256 using ACS Access Key.

  • Sends via cURL to ACS endpoint.

  • Returns true to WordPress if ACS responds with HTTP 202 (Accepted).

Security Notes

  • Never commit your ACS_ACCESS_KEY to version control.

  • Use environment variables (.env) for secure management.

  • Rotate your ACS keys periodically.

License

  • MIT – free to use, modify, and distribute. See LICENSE for details.