Visit Our UNIX and Linux User Community

postfix sender address rewriting

Thread Tools Search this Thread
Top Forums UNIX for Advanced & Expert Users postfix sender address rewriting
# 1  
Old 09-07-2009
postfix sender address rewriting


I have a postfix server that relays to an exchange server. All of my unix/linux systems send to this server, the problem is the form the mail is sent with,

the sender address is


I need to rewrite every sender address to

for this I added the following entry to

sender_canonical_maps = hash:/etc/postfix/canonical



I ran the postmap command and restarted the mailserver

but it's not working, any idea?

Edit: ok found the solution


sender_canonical_maps = regexp:/etc/postfix/canonical

instead of hash, works now

Edit2: but just works for localhost, and not for relay hosts Smilie

needed to append the line
local_header_rewrite_clients = static:all


hurray!! Smilie


hm now I need a solution, that writes the original hostname to the subject, because now I can't determine the sender host
of course it can be added to the specific mail script, but we have about 300 mailscripts


have the solution, regular expressions and header_checks, details tomorrow

header_checks = regexp:/etc/postfix/header_checks

to /etc/postfix/header_checks:
/From:.* <.*@(.*)\.domain.local>/ REPLACE From: $1 <>

this will not write the hostname to the subject, it writes it to the from field, looks like
From: hostname <>

outlook displays this name in the from column, which is absolutely perfect for my needs

Last edited by funksen; 09-08-2009 at 05:17 AM..

Previous Thread | Next Thread
Test Your Knowledge in Computers #751
Difficulty: Medium
The first IBM 5150 PCs had two 5.25-inch 360 KB single sided double density (SSDD) floppy disk drives
True or False?

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Mailx command to include sender address

Hi, I m using mailx to send email. I am using sender=server name(display name) echo "body" | mailx -s "subject" -b "bcc address" "to address" -- -f "$sender". I should get email with sender as only display name. In stead i am getting displayname@server address. Please suggest Use code... (1 Reply)
Discussion started by: usrrenny
1 Replies

2. Solaris

How to force Sendmail to Rewrite Sender Address?

Need to change sender email id from applmgr@<hostname>.<domain-name> to applmgr@domain-name. Understand we can change in the where $j is the hostname.domain-name.. can anyone show the exact value to change? Thank you. (8 Replies)
Discussion started by: KhawHL
8 Replies

3. UNIX for Advanced & Expert Users

Postfix sender problem

Hi All! I have a very annoying problem. I have an openSuSE box, running postfix on it. It is configured, to use gmail to send mails. It is working fine, I accept the messages, but the sender is my gmail account, not the linux box. How can I (if I can) configure postfix to send the mails with... (0 Replies)
Discussion started by: szzed
0 Replies

4. Red Hat

How to change sender email address in mail -s command

Just having trouble trying to figure out what the option is. When I do mail -s "Subject" I can't seem to specify "from" or "sender" option as I need it for my task. I tried using --f or -f though it didn't work. Can someone please tell me what other option... (0 Replies)
Discussion started by: rockf1bull
0 Replies

5. Shell Programming and Scripting

Changing the sender Email address to Alias

Hi All, I want to change the email address of the sender to some alias for eg: needs to be changes to TEST Please help me. (3 Replies)
Discussion started by: sithara
3 Replies

6. UNIX and Linux Applications

sendmail recipient address rewriting with local_relay or mail_hub

I'm trying to make this work with a variety of different sendmail versions (all 8.8 or better) and different OS's. I have to configure all my unix workstations to deliver all email through a relay ''. This includes unqualified names as well as qualified names and remote... (1 Reply)
Discussion started by: icefalcon
1 Replies

7. Shell Programming and Scripting

Sender email address has to changes

I am sending email with attachment using mail and uuencode command. Ex: (echo "$EMAIL_BODY"; uuencode $FILE ATTACH.TXT) || mail "$EMAIL_ID" -s "$EMAIL_SUB" I am getting email from "". I want to change this email address into... (1 Reply)
Discussion started by: balajiora
1 Replies

8. UNIX for Dummies Questions & Answers

Different Sender Address

Hello Following command send link to division managers. echo http://severname:8081/account-reports/2008Jun19-2008Jun25.2/index.html | mail -s "Weekly Division Sales Report" QUESTION. Above command send a body which is link of division report in email with... (1 Reply)
Discussion started by: paulds
1 Replies

9. AIX

Change sender e-mail address

When sending emails to the outside world, aix present itself as This is causing some issue with our e-mail server. So we need to change the name to Does any one know how this can be accomplished? Thank you (3 Replies)
Discussion started by: cchiang12
3 Replies

10. UNIX for Dummies Questions & Answers

mailx sender address customisation

Hi All, I'm on UNIX -Solaris... I'm trying to send mail usin Mailx..... The script is working fine and attachments are also being sent.... BUT, when I receive the mail,, the sender address shown is the unix login id name.... Any way by which I could manipulate this in my script command or any... (1 Reply)
Discussion started by: vasan_srini
1 Replies

Featured Tech Videos