AWS SES envelope sender mapping for subdomain addresses
-
I am using SureMail to send WordPress emails via AWS SES. I need to implement a one-to-one mapping between visible From addresses and SES verified envelope senders.
For example: Visible From SES Verified MAIL FROM
newsletter@sub.example.com => newsletter@verified.sub.example.com
contact@example.com => contact@verified.example.com
notify@example.com => notify@verified.example.com
I want the visible From address to remain friendly for recipients, while the SES MAIL FROM / Return-Path uses the verified subdomain address (as above), because AWS SES requires verified senders for envelope addresses.
My issue is that my existing WordPress
wp_mailandphpmailer_initfilters work in logs, but SureMail overrides the envelope sender, so the mapping does not take effect in actual outgoing emails.Could you please provide:
- The exact filter or action hook in SureMail that allows me to modify the SES envelope sender (
MAIL FROM) before sending. - Any guidance or example on how to implement this mapping properly in SureMail.
For reference:
- WordPress version: 6.8.3
- SureMail version: 1.9.0
Thank you very much for your help!
Example anonymized PHP snippet for SureMail:
<?php /** * Map friendly visible From → SES verified MAIL FROM for SureMail * Place in: wp-content/mu-plugins/fc-ses-suremail-map.php */ add_filter('suremail_pre_send_email', function($email) { // One-to-one mapping: visible From → SES verified envelope sender $map = [ 'newsletter@sub.example.com' => 'newsletter@verified.sub.example.com', 'contact@example.com' => 'contact@verified.example.com', 'notify@example.com' => 'notify@verified.example.com', ]; // Get the visible From email $from = strtolower(trim($email['from'] ?? '')); // Apply mapping if exists if (isset($map[$from])) { $email['envelope_from'] = $map[$from]; // sets actual SES MAIL FROM / Return-Path error_log("SureMail SES MAP: {$from} → {$map[$from]}"); } else { error_log("SureMail SES MAP: No mapping for {$from}"); } return $email; }, 20); - The exact filter or action hook in SureMail that allows me to modify the SES envelope sender (
You must be logged in to reply to this topic.