1

I have a server process sending out mail using one out of a handful of addresses in the From header. Unfortunately, the program does not set the sender header resulting in "{Sender} on behalf of {From}" in Outlook user's inboxes.

Is there a way to make the sender header match the from header for outgoing mail from this user?

1 Answer 1

2

The envelope sender is set by the mail client when sending mail; it is not a header and appears nowhere in the mail body.

Postfix, being an MTA, doesn't really care about From: headers, except insofar as it can rewrite them based on the envelope sender or some other rule, if you so desire.
This can be useful in situations where the internal postfix domain is not externally valid (such as [email protected]) to enable the recipient to respond to the message; the envelope sender is set as the Return-Path: header upon delivery of the message.

I've never seen a requirement to perform the inverse, i.e. change the envelope sender based on a From: header; since headers are trivially forged this would enable an easy spam target.

What you should do instead is the following:

  1. set up postfix to require submission as defined in RFC4409, using both TLS and SASL, for all locally submitted mail; see the commented-out example in master.cf.
  2. disallow submission of mail via the MTA port (25) by removing permit_mynetworks from smtpd_*_restrictions.
  3. disallow submitting mail via the sendmail(1) command and all its derivatives via the authorized_submit_users parameter
  4. configure your application to use a dedicated login that will restrict the envelope sender via the smtpd_sender_login_maps parameter
  5. configure your application to set the proper envelope sender when submitting mail.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .