I have an email server that has been configured as follows:

In the main.cf file:

mydomain = example.com.au 
myhostname = mail.example.com.au

myorigin = $mydomain

relay_domains = example.com.au, second-domain.com.au, third-domain.com.au
sender_dependent_relayhost_maps = hash:/etc/postfix/relay_maps

In the relay_maps file:

@example.com.au                example.mail.protection.outlook.com 
@second-domain.com.au          join-account.mail.protection.outlook.com 
@third-domain.com.au           join-account.mail.protection.outlook.com 

When I sent test emails as follows

echo "Test body message" | mail -r root@example.com.au -s "Test" user@recipient.com
echo "Test body message" | mail -r root@second-domain.com.au -s "Test" user@recipient.com
echo "Test body message" | mail -r root@third-domain.com.au -s "Test" user@recipient.com

In the maillog, I get the following:

/var/log/maillog-20230319:Mar 16 12:07:34 localhost postfix/pickup[21775]: BB74AE48E6: uid=0 from=<root@example.com.au>
/var/log/maillog-20230319:Mar 16 12:07:34 localhost postfix/cleanup[21845]: BB74AE48E6: message-id=<641279e6.TdzLT/bSgjlhn7Bl%root@example.com.au>
/var/log/maillog-20230319:Mar 16 12:07:34 localhost postfix/qmgr[21776]: BB74AE48E6: from=<root@example.com.au>, size=451, nrcpt=1 (queue active)
/var/log/maillog-20230319:Mar 16 12:07:36 localhost postfix/smtp[21847]: BB74AE48E6: to=<user@recipient.com>, relay=example.mail.protection.outlook.com[]:25, delay=2.2, delays=0.02/0/0.71/1.4, dsn=2.6.0, status=sent (250 2.6.0 <641279e6.TdzLT/bSgjlhn7Bl%root@example.com.au> [InternalId=26749056322659, Hostname=M] 9129 bytes in 0.316, 28.191 KB/sec Queued mail for delivery)
/var/log/maillog-20230319:Mar 16 12:07:36 localhost postfix/qmgr[21776]: BB74AE48E6: removed

/var/log/maillog-20230319:Mar 16 12:07:34 localhost postfix/pickup[21775]: BFC53E48E7: uid=0 from=<second-domain.com.au>
/var/log/maillog-20230319:Mar 16 12:07:34 localhost postfix/cleanup[21845]: BFC53E48E7: message-id=<641279e6.Sik6/lNpLuRRC7RY%second-domain.com.au>
/var/log/maillog-20230319:Mar 16 12:07:34 localhost postfix/qmgr[21776]: BFC53E48E7: from=<second-domain.com.au>, size=461, nrcpt=1 (queue active)
/var/log/maillog-20230319:Mar 16 12:07:36 localhost postfix/smtp[21848]: BFC53E48E7: to=<user@recipient.com>, relay=join-account.mail.protection.outlook.com []:25, delay=2.1, delays=0.03/0.01/0.69/1.4, dsn=2.6.0, status=sent (250 2.6.0 <641279e6.Sik6/lNpLuRRC7RY%second-domain.com.au> [InternalId=99643241270213, Hostname=] 9199 bytes in 0.250, 35.892 KB/sec Queued mail for delivery)
/var/log/maillog-20230319:Mar 16 12:07:36 localhost postfix/qmgr[21776]: BFC53E48E7: removed

/var/log/maillog-20230319:Mar 16 12:07:34 localhost postfix/pickup[21775]: C009CE48E8: uid=0 from=<root@third-domain.com.auu>
/var/log/maillog-20230319:Mar 16 12:07:34 localhost postfix/cleanup[21845]: C009CE48E8: message-id=<641279e6.lNkWMtQOKwv22cDQ%root@third-domain.com.au>
/var/log/maillog-20230319:Mar 16 12:07:34 localhost postfix/qmgr[21776]: C009CE48E8: from=<third-domain.com.au>, size=449, nrcpt=1 (queue active)
/var/log/maillog-20230319:Mar 16 12:07:36 localhost postfix/smtp[21849]: C009CE48E8: to=<user@recipient.com>, relay=join-account.mail.protection.outlook.com []:25, delay=1.5, delays=0.03/0.01/0.5/0.94, dsn=2.6.0, status=sent (250 2.6.0 <641279e6.lNkWMtQOKwv22cDQ%root@casselsauto.com.au> [InternalId=86955907880957, Hostname=] 9088 bytes in 0.242, 36.660 KB/sec Queued mail for delivery)
/var/log/maillog-20230319:Mar 16 12:07:36 localhost postfix/qmgr[21776]: C009CE48E8: removed

Rely is working as intended.

However, when I send emails from from the different domains through our application, the emails are always from apps@example.com.au. For example, when I sent an email from user@second-domain.com.au and user@third-domain.com.au from the application, the maillog shows the email as from apps@example.com.au but on mail email client, the from address is user@second-domain.com.au.

My question are as follows:

  • The from address in the log differs from what I see in Outlook. Is the from address I see in the maillog the envelope from and what I see in Outlook the email from?
  • Is there a setting in Postfix to change the envelope from to match whatever the application set the from address to be?
  • Or does this have to be done at the application/client that is sending the email? I am still trying to figure out when the application is using some script such PHP or whether it is using sendmail/mailx to send emails.

1 Answer 1


Application was using sendmail to send out emails with just the -t option. The email from address, email to address, subject, body and attachment was set in the -t option.

However, there is no envelope from address. This was fixed with -f option and the envelope from address.

You must log in to answer this question.

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