zone-eu / zone-mta

📤 Modern outbound MTA cross platform and extendable server application
European Union Public License 1.2
583 stars 93 forks source link

zone routingHeaders not working through SMTP interface? #384

Open ezp-matt opened 2 months ago

ezp-matt commented 2 months ago

I'm attempting to forward transactional emails to Postmark's SMTP service if the email has a X-PM-Message-Stream header set. I've set up a zone called transactional with routingHeaders like so:

transactional: {
      pool: 'default',
      host: 'smtp.postmarkapp.com',
      port: 587,
      auth: {
        user: '<redacted>',
        pass: '<redacted>'
      },
      routingHeaders: { 'X-PM-Message-Stream': 'transactional' }
}

and I'm testing with this email:

From: "Sender" <sender@redacted.domain>
To: "Recipient" <recipient@redacted.domain>
Subject: This is a test
X-PM-Message-Stream: transactional

I’m sending this mail through Zone MTA.

When I upload this email using the "Upload Message" function of the zmta-webadmin package (which I'm assuming uses the API), it works fine, and is routed to my transactional zone properly. However if I send the exact same message via SMTP using curl, it is always sent through the default zone.

Am I missing something? I set allowRoutingHeaders: [ 'api', 'bounce', 'feeder' ] in the core/default-headers plugin settings, but from what I can gather from reading the source code, that only applies to the X-Sending-Zone header.

Any advice would be appreciated.

louis-lau commented 2 months ago

Maybe you have a plugin overwriting the zone? Most of the plugin hooks only run for messages submitted through SMTP.

ezp-matt commented 2 months ago

Maybe, I'm using the stock zone-mta-template configuration (just installed it for the first time yesterday). I definitely don't have any custom plugins. I'll try disabling the plugins it comes with installed and see if it makes a difference.

louis-lau commented 2 months ago

Hmm, to my knowledge the default template setup doesn't have anything that overwrites the zone. Sorry, don't know in that case!

ezp-matt commented 2 months ago

I just disabled all the built-in plugins and tried again and got the same result. Thanks for the suggestion, though!