LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 07-16-2011, 12:47 PM   #1
kforbus
Member
 
Registered: Sep 2009
Location: Maryland
Distribution: Slackware
Posts: 68

Rep: Reputation: 29
Sendmail Sender Address Rewrite


I have sendmail configured as a smart relay to an Exchange server. The mail relay is working fine and only has to worry about relaying mail from a single application address to the end users. The problem is that those users are in separate domains and neither wants to see these application mails as coming from the other domain.

I'm trying to find out if it would be possible to rewrite the sender address based on the recipient address. So if a message is sent from application@domainA.com to someuser@domainB.com, the "From" address would show as application@domainB.com.

Has anyone done something like this before? My research so far has shown that a milter like MIMEdefang could possibly accomplish this, but I'm not 100% sure if that's the right track or not.

I'm open to suggestions or examples of how I might achieve this.
 
Old 07-16-2011, 09:35 PM   #2
kforbus
Member
 
Registered: Sep 2009
Location: Maryland
Distribution: Slackware
Posts: 68

Original Poster
Rep: Reputation: 29
I ended up not using Sendmail for this after all. Instead I installed Postfix using a Slackbuild from Slackbuilds.org and enabled it to relay to my Exchange server.

The first step was adding an additional transport in /etc/postfix/master.cf that looked like:
Code:
smtp2     unix  -       -       n       -       -       smtp -o smtp_generic_maps=regexp:/etc/postfix/generic_smtp2
Then I added this line to /etc/postfix/main.cf:
Code:
transport_maps=regexp:/etc/postfix/transport
Next I added this to /etc/postfix/transport:
Code:
/@domainB\.com/      smtp2:[<IP or Name of Exchange Server>]
That line tells it to use my new transport for any mail addressed to someone @domainB.com.

Created and edited /etc/postfix/generic_smtp2 to look like:
Code:
/^(.*)@domainA\.com/      $1@domainB.com
Finally ran
Code:
postmap /etc/postfix/generic_smtp2
and restarted postfix.

Now any messages from domainA.com to users at domainA.com are unaffected. But if the email is addressed to someone at domainB.com, then the sender address is rewritten to look like it's from domainB.com as well.

I had to actually create a user account in Exchange for the address after it gets rewritten (such as application@domainB.com) so that if a user replies, it actually goes to a mailbox.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Rewrite sender address in postfix williebens Linux - Server 27 11-07-2014 05:29 AM
Change sendmail's sender address anon091 Linux - Newbie 17 06-18-2010 01:16 PM
sendmail sender address nasim2 Linux - Distributions 1 10-27-2009 04:14 AM
Postfix: Is it possible to rewrite sender address only for selective recipient? Akhran Linux - Software 3 08-15-2006 10:48 AM
Sendmail Domain of sender address does not exist mantiev Linux - Networking 0 05-08-2001 07:58 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 10:12 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration