Precedence: transaction
Дмитрий Родин (RodinBlog)
Hello MailPoet Team,
I am using MailPoet to send emails via a custom SMTP server (api.samotpravil.ru). My SMTP provider requires that I include the header Precedence: transaction in all outgoing emails to disable their local stop-list.
I have tried several approaches, but the header either doesn't get added or is overwritten. I need guidance on the correct MailPoet hook to use.
Environment details:
MailPoet version: last
WordPress version: 6.x
Sending method: SMTP (configured with host api.samotpravil.ru, port 1126)
What I've tried:
Using WordPress phpmailer_init hook — this works for regular wp_mail() but doesn't seem to fire for MailPoet's sending process.
Using MailPoet's mailpoet_mailer_smtp_options filter — I can see in the debug log that my function is called and I add the header to $options['custom_headers'], but the final email still shows Precedence: bulk. Here's the code I used:
php
add_filter('mailpoet_mailer_smtp_options', function($options) {
$options['custom_headers'] = ['Precedence:transaction'];
return $options;
});
Using mailpoet_mailer_smtp_transport_agent — this filter is marked as deprecated in your documentation, but I tried it anyway. It either doesn't fire or the header is still overwritten.
My questions:
What is the correct and currently recommended hook in MailPoet for adding custom SMTP headers (like Precedence) to all outgoing emails?
Is there a way to ensure that my custom header overrides any default header that MailPoet might be adding?
Could MailPoet be adding a Precedence: bulk header automatically? If so, how can I prevent this or replace it with my own?
If mailpoet_mailer_smtp_options is the right filter, why might my header not appear in the final email, even though it's present in the $options array?
Debug log entry (showing my filter is called):
text
[07-Mar-2026 11:51:51 UTC] === Added Precedence exactly as in support example ===
[07-Mar-2026 11:51:51 UTC] Header: Precedence:transaction
But the received email still shows:
text
Precedence: bulk
Any guidance would be greatly appreciated. I'm happy to provide more details or run additional tests if needed.
Thank you