0

I'm trying to relay mail via Postfix and change the sender address whilst also passing DKIM/DMARC validation.

So if I send an email from user1@domainA.com via the Postfix relay (using it as a smart host), it will relay the email on to the destination as expected. But I want to change the from (sender) address as it passes through the relay to user1@domainB.com, where domainB.com is the name of the relay.

I've tried using PostSRSd, which does change the email but doesn't change the From address, so when the final user receives the email it still appears to be from user1@domainA.com, and when the end user replies it goes back to user1@domainA.com. I want it to appear to be from user1@domainB.com, and when the end user replies for it to go back to user1@domainB.com.

An added complication is that I want the message to pass validation when it gets to the end user. I have integrated with RSPAMD to enable both DKIM and ARC.

If I use header re-writing in Postfix (smtp_header_checks) to force re-write the From header using Regexp then the validation fails at the end user and the message is marked as spam.

Any ideas please?

UPDATE

So I have found a working solution of sorts. I found that part of the problem is that the signing of the message (DKIM) takes place before the change of the sender (from address), or in Postfix terms, pre-queue.

So I split the problem across two Postfix instances. The first changes the from address, and relays the message to a second Postfix instance. That signs the message using DKIM, with the changed from address, and then the end user receives the email and it passes validation because it has been correctly signed.

Ideally I would do everything in one instance of Postfix, but I can live with this as a workaround.

If anyone has any other ideas please let me know!

  • You can probably achieve this through the mail application you are using to send mail. what application are you using ? Other than the mta (postfix) give some more info about your setup. – Ragav May 21 '20 at 14:41
  • I'm using Outlook/Exchange, which I think would not be happy about changing the sender address and signing the message with DKIM for a domain it doesn't control, so I want to do this entirely in Postfix if at all possible. – cloudtester May 22 '20 at 07:21

0 Answers0