Forum Discussion
Stephan_87795
Nimbostratus
Sep 23, 2008sender address in eMails sent by postfix
Hello all,
I am trying to use postfix-settings (/etc/postfix/) for sending mails from the bigIP directly to my account.
By default the sender address is like "root@mydomain.tld", so it always takes "root" as the user account. Unfortunately, I can't use "root" within our SMTP-environment, therefore it would be quite valuable for me being able to change the sender's user account to something like "LTM1@mydomain.tld".
Does anyone know where to change this exactly? I was trying to do this in /etc/postfix/aliases, but did not get to a satisfying result so far...:-(
Thanks for any good ideas.
Cheers,
Stephan
19 Replies
- JRahm
Admin
Edit /etc/postfix/main.cf:
SENDING MAIL
The myorigin parameter specifies the domain that locally-posted
mail appears to come from. The default is to append $myhostname,
which is fine for small sites. If you run a domain with multiple
machines, you should (1) change this to $mydomain and (2) set up
a domain-wide alias database that aliases each user to
user@that.users.mailhost.
For the sake of consistency between sender and recipient addresses,
myorigin also specifies the default domain name that is appended
to recipient addresses that have no @domain part.
myorigin = $myhostname
myorigin = $mydomain - Stephan_87795
Nimbostratus
Hi,
thanks for the quick reply - I already tried it at that point. But this will only let me change the domain, not the user.
I am only interested in changing the part before the @. Changing the domain is working just fine.
Thanks though....
Cheers,
Stephan - JRahm
Admin
Sorry, jumped the gun on that... :-)
The way to set that up is to add this line to your main.cf file:
echo "smtp_generic_maps = hash:/etc/postfix/generic" >> /etc/postfix/main.cf
Then create the map:
echo "root@localhost fromMe@mydomain.com" > /etc/postfix/generic
Then apply the map:
postmap /etc/postfix/generic
Then restart postfix (bigstart restart postfix on the LTM)
This works on ubuntu (minus the bigstart command), but doesn't change the behavior on the F5 at all. Drat!
maybe Support can help? - Stephan_87795
Nimbostratus
Hi,
I finally found the bullet:
the map (e.g. /etc/postfix/generic) also needs to be listed as following parameter in main.cf
sender_canonical_maps = hash:/etc/postfix/generic
Then restart postfix and -abracadabra-......
Thanks for leading me the way! :-)
Best Regards,
Stephan - JRahm
Admin
Excellent work, thanks for posting back! - JRahm
Admin
Hmm, still no change for me, I still get the root. Can you post your config, and your LTM version? Thanks - Stephan_87795
Nimbostratus
OK - I tried several things before so maybe they work in co-incidence:
LTM-Version is 9.4.4 Build 73.1 HF1
all my examples are to understand as myuser@mydomain.com
just replace those with your user / domain
config:
in /etc/postfix/aliases:
I changed any alias from root to myuser, the last one as well -> root: myuser
Then use the command 'newaliases' to rebuild aliases.db
in /etc/postfix/canonical:
root myuser@mydomain
root@bigIPs_hostname myuser@mydomain
root@localhost myuser@mydomain
root@mydomain myuser@mydomain
root@mydomain.com myuser@mydomain
then create the map with postmap /etc/postfix/canonical
in etc/postfix/main.cf:
mydomain = mydomain.com
myorigin = $mydomain
relayhost = [ip.of.your.smtpserver] (mind the brackets)
sender_canonical_maps = hash:/etc/postfix/canonical
alias_maps = hash:/etc/postfix/aliases
alias_database = hash:/etc/postfix/aliases
then, restart postfix.
From that point, it worked for me...
Best Regards,
Stephan - Stephan_87795
Nimbostratus
sorry - for canonical i meant:
root myuser@mydomain.com
root@bigIPs_hostname myuser@mydomain.com
root@localhost myuser@mydomain.com
root@mydomain myuser@mydomain.com
root@mydomain.com myuser@mydomain.com - JRahm
Admin
OK, with your lead, I was able to get this to work with this minimal configuration:echo "" >> /etc/postfix/main.cf echo " Customized for SMTP Sender Identification" >> /etc/postfix/main.cf echo "" >> /etc/postfix/main.cf echo "relayhost = 192.168.1.2" >> /etc/postfix/main.cf echo "sender_canonical_maps = hash:/etc/postfix/canonical" >> /etc/postfix/main.cf echo "root LTM1@domain.com" > /etc/postfix/canonical echo "root@LTM1 LTM1@domain.com >> /etc/postfix/canonical echo "root@localhost LTM1@domain.com >> /etc/postfix/canonical echo "root@domain LTM1@domain.com >> /etc/postfix/canonical echo "root@domain.com LTM1@domain.com >> /etc/postfix/canonical postmap /etc/postfix/canonical bigstart restart postfix echo TEST | mail -s TEST me@domain.com
Note that the display name (in Outlook anyway) still shows root, but the mail source address is LTM1@domain.com - Per_Andersson
Nimbostratus
Hello.
I know I'm waking up a quite old thread, but...:
In my case I would rather just change the sender for the F5-related messages,
not just any system-related mail. For example when the EM (Enterprise Manager)
notifies about expiring certificates, those mails should not come from root,
but I can't find any possibility of tweaking that. Anybody got any ideas ?
/Per
Recent Discussions
Related Content
DevCentral Quicklinks
* Getting Started on DevCentral
* Community Guidelines
* Community Terms of Use / EULA
* Community Ranking Explained
* Community Resources
* Contact the DevCentral Team
* Update MFA on account.f5.com
Discover DevCentral Connects
