Integrations / WordPress

Sendersy + WordPress

WordPress + Sendersy: override wp_mail() via an mu-plugin so every WP email goes through the Sendersy API. Works with WooCommerce, Contact Form 7 and any other plugin.

1. Install

bash
# 1) Create file /wp-content/mu-plugins/sendersy-mailer.php
# 2) Add SENDERSY_API_KEY as a constant in wp-config.php

2. Environment variables

bash
// wp-config.php
define('SENDERSY_API_KEY', 'sk_live_...');
define('SENDERSY_FROM',    'WordPress <noreply@yourdomain.com>');

3. Send an email

php
<?php
/**
 * Plugin Name: Sendersy Mailer
 * Description: Sends all wp_mail() calls through the Sendersy API.
 * Place at /wp-content/mu-plugins/sendersy-mailer.php (auto-loaded).
 */

if (!function_exists('wp_mail')) {
    function wp_mail($to, $subject, $message, $headers = '', $attachments = []) {
        $apiKey = defined('SENDERSY_API_KEY') ? SENDERSY_API_KEY : '';
        $from   = defined('SENDERSY_FROM')    ? SENDERSY_FROM    : get_option('admin_email');
        if (!$apiKey) return false;

        $recipients = is_array($to) ? $to : [$to];

        $resp = wp_remote_post('https://api.sendersy.com/v1/emails', [
            'headers' => [
                'Authorization' => 'Bearer ' . $apiKey,
                'Content-Type'  => 'application/json',
            ],
            'body' => wp_json_encode([
                'from'    => $from,
                'to'      => $recipients,
                'subject' => $subject,
                'html'    => $message,
                'tags'    => [['name' => 'source', 'value' => 'wordpress']],
            ]),
            'timeout' => 15,
        ]);

        return !is_wp_error($resp) && wp_remote_retrieve_response_code($resp) === 200;
    }
}

4. Using a stored template

php
// Alternative: use the WP Mail SMTP plugin
// Settings → WP Mail SMTP → pick "Other SMTP" and fill:
//   Host:       smtp.sendersy.com   (Postal MTA — issued after you add a domain)
//   Port:       587
//   Encryption: TLS
//   Auth:       ON
//   Username:   your SMTP login (issued in the Sendersy dashboard)
//   Password:   your SMTP password
// This path requires no code — all WP mail will go via Sendersy SMTP.

Ready to start?

Get your API key in 30 seconds.

Sign up