Score:1

Configuring postfix to use SendGrid SMTP relay with fixed FROM address but need to append REPLY-TO of original sender

bb flag

I have been trying to resolve for a couple of months using multiple different configurations.

The local delivery to a Dovecot mailbox ([email protected]) keeps the original sender ([email protected]) in the FROM address. The remote delivery using SendGrid SMTP server via a virtual forward to ([email protected]) works if:

in smtp_header_checks if there is

/^From:(.*)$/   REPLACE From: [email protected]

and in main.cf

sender_canonical_classes = envelope_sender
smtp_header_checks = regexp:/etc/postfix/smtp_header_checks

I have tried to add a reply-to to the header so that the receivers, who get the forwarded email, can reply to it.

In smtp_header_checks I put

/^From:(.*)$/  REPLACE Reply-To:$1<br>
/^From:(.*)$/   REPLACE From: [email protected]

but this gives a 550 Error

Feb 14 13:40:03 club-jowett-vm postfix/smtp[12857]: BB2AD65E91: replace: header From:  <[email protected]>: From: [email protected]  Reply-To: <[email protected]>
Feb 14 13:40:03 t-vm postfix/smtp[12857]: BB2AD65E91: to=<[email protected]>, orig_to=<[email protected]>, relay=smtp.sendgrid.net[54.228.39.88]:587, delay=2.3, delays=1.6/0.19/0.48/0.05, dsn=5.0.0, status=bounced (host smtp.sendgrid.net[54.228.39.88] said: 550 The from address does not match a verified Sender Identity. Mail cannot be sent until this error is resolved. Visit https://sendgrid.com/docs/for-developers/sending-email/sender-identity/ to see the Sender Identity requirements (in reply to end of DATA command))

I have tried other configurations one of which added the reply-to but some receivers rejected the email because of multiple ReplyTo headers.

I have also tried /^From:(.*)$/ PREPEND Reply-To:$1 which gives the same 550 error.

Has anyone a configuration that works, please?

danielj avatar
br flag
Did you resolve this? I've been banging my head against the same problem for days. It seems like it would be a fairly common use case.
kcfez avatar
bb flag
Sadly no. I suspect the lack of a solution is there to block spoofing and spam. I live in hope.
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.