Changing default mail "from address"

Using Leap 15.4 and Postfix 3.5.9 and mail 12.5.
I am trying to get my email server to send emails from system and cron jobs etc. and via the CLI . However, unless I specify the “-r” from address parameter in the scriptfile for the mail command they are bounced, as the emails are from root or user. I need to set a default from address such as I have looked at the output of info mail and I see reference in the -r address information and it refers to environment or startup variables.

Typical error message is:-
2022-12-26T15:46:55.848604+00:00 venus postfix/qmgr[13107]: CBE4B6F400B:, size=414, nrcpt=1 (queue active)
2022-12-26T15:46:57.312754+00:00 venus postfix/smtp[22026]: CBE4B6F400B:,[]:25, delay=1.5, delays=0.03/0.01/0.33/1.1, dsn=5.1.0, status=bounced (host[] said: 550 5.1.0 From address is invalid (VM402) (in reply to MAIL FROM command))

Can someone help with telling what variable to set and how.



Edit the /etc/postfix/aliases file, then run the command newaliases.

Hi Malcom,
Tried that early on and apparently it only works for “local delivery”. I did set root to in the alias file and ran newaliases - no luck. The log file still shows root


Hi, has the alias map been set? Run postconf alias_maps

venus:/etc # postconf alias_maps
alias_maps = lmdb:/etc/aliases

so it looks to be ok.
/etc/postfix/aliases contains
“# Person who should get root’s mail. Don’t receive mail as root!”


Some nice reading: Postfix Address Rewriting

BTW: I have no idea why you won’t use mail -r. Can you explain?

Hi, so it’s pointing to a different aliases file… /etc/aliases update that one not /etc/postfix/aliases

Hi Karl,
I have indeed edited as many script files I can find and added the -r parameter. I wanted the system to send any system email to me and wanted a system wide setting.

I updated /etc/aliases and re-ran newaliases, restarted postfix - no improvement


Hi Karl,
I used Generic mapping and success it seems to be working.
I added
smtp_generic_maps = lmdb:/etc/postfix/generic to
I added
root to /etc/postfix/generic

then ran
postmap /etc/postfix/generic - as instructed in the text

Restarted postfix and it worked. (had to dig it out of spam but now works)
I will see what if any errors I get

Many thanks to both yourself and Malcolm



Thanks for the feedback. Postfix documentation is terse, but accurate: Postfix Address Rewriting