LinuxQuestions.org
Visit Jeremy's Blog.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Server
User Name
Password
Linux - Server This forum is for the discussion of Linux Software used in a server related context.

Notices


Reply
  Search this Thread
Old 12-28-2010, 03:04 PM   #16
williebens
Member
 
Registered: Jan 2008
Posts: 88

Original Poster
Rep: Reputation: 16

This would be the content for sender_canonical and recipient_canonical respectively:

recipient_canonical:
/^((dbsupport|helpdesk).*)thisdomain[.]com$/ admins@thatdomain.com

sender_canonical
/^(.*)thisdomain[.]com$/ ${1}thatdomain.com


Also, can you tell me is this can be done using virtual maps?
I apologize for all these questions, but I am under a lot of stress right now. If I don't get this working, I will be in trouble.

Thanks.
--Willie
 
Old 12-28-2010, 03:11 PM   #17
Reuti
Senior Member
 
Registered: Dec 2004
Location: Marburg, Germany
Distribution: openSUSE 15.0
Posts: 1,337

Rep: Reputation: 259Reputation: 259Reputation: 259
What was the original command for the output you got:
Code:
myself@box1$ mail myself@thatdomain.com
? The sender is still not changed, but on the commandline a
Code:
postmap -q "myself@box1.thisdomain.com" regexp:/etc/postfix/sender_canonical
is working? What is in /var/log/mail on box1?
 
Old 12-28-2010, 03:30 PM   #18
Reuti
Senior Member
 
Registered: Dec 2004
Location: Marburg, Germany
Distribution: openSUSE 15.0
Posts: 1,337

Rep: Reputation: 259Reputation: 259Reputation: 259
Quote:
Originally Posted by williebens View Post
/^(.*)thisdomain[.]com$/ ${1}thatdomain.com
Small change:
Code:
/^(.*@).*thisdomain[.]com$/ ${1}thatdomain.com
to get rid of box1 in the address. I suggest to look into regular expressions.
Code:
$ postmap -q "myself@box1.thisdomain.com" regexp:tester
myself@thatdomain.com
Quote:
Originally Posted by williebens View Post
Also, can you tell me is this can be done using virtual maps?
I don't know, I never used them. But AFAICS the idea is different: you will host a virtual thatdomain.com on thisdomain.com then, but in your original post you specified "rewrite the sender's address", not hosting a domain.
 
Old 12-28-2010, 03:45 PM   #19
williebens
Member
 
Registered: Jan 2008
Posts: 88

Original Poster
Rep: Reputation: 16
Hello Reuti:

Thanks for your updates. I first thought that I needed to rewrite the sender's address, but things have changed. What I really need to do is tell postfix that every email sent to


dbsupport@thisdomain.com
and
helpdesk@thisdomain.com

to

be sent to admins@thatdomain.com

Thanks.
--Willie
 
Old 12-28-2010, 03:46 PM   #20
williebens
Member
 
Registered: Jan 2008
Posts: 88

Original Poster
Rep: Reputation: 16
If I dont pull this one off, I think I better start looking for another job. I am serious and nervous at the same time.
 
Old 12-28-2010, 03:58 PM   #21
Reuti
Senior Member
 
Registered: Dec 2004
Location: Marburg, Germany
Distribution: openSUSE 15.0
Posts: 1,337

Rep: Reputation: 259Reputation: 259Reputation: 259
The recipient_canonical rule I posted should do it. You can also check this: http://www.postfix.org/ADDRESS_REWRITING_README.html
 
Old 12-28-2010, 04:14 PM   #22
williebens
Member
 
Registered: Jan 2008
Posts: 88

Original Poster
Rep: Reputation: 16
Hello Reuti:

Unfortunately, your suggestion did not work for me.
I apologize for that. At the same time, I want to really thank you for your help.

I will keep searching on how to get this to work. If you happen to have any other suggestion(s), feel free to let me know.

Thanks.
--Willie
 
Old 12-28-2010, 05:28 PM   #23
williebens
Member
 
Registered: Jan 2008
Posts: 88

Original Poster
Rep: Reputation: 16
This is what if in /var/log/mail in box1:


Dec 28 16:10:25 box1 postfix/pickup[19291]: 54D258F726: uid=0 from=<root>
Dec 28 16:10:25 box1 postfix/cleanup[23489]: 54D258F726: message-id=<4D1A5241.mailIBZ11LRR6@box1.thisdomain.com>

Dec 28 16:10:25 box1 postfix/qmgr[4846]: 54D258F726: from=<root@box1.thisdomain.com>, size=438, nrcpt=1 (queue active)
Dec 28 16:10:25 appatl7 postfix/cleanup[23489]: 5CE3E8E133: message-id=<4D1A5241.mailIBZ11LRR6@box1.thisdomain.com>

Dec 28 16:10:25 box1 postfix/local[23766]: 54D258F726: to=<root@box1.thisdomain.com>, orig_to=<root>, relay=local, delay=0, status=sent (forwarded as 5CE3E8E133)
Dec 28 16:10:25 box1 postfix/qmgr[4846]: 5CE3E8E133: from=<root@box1.thisdomain.com>, size=596, nrcpt=1 (queue active)
Dec 28 16:10:25 box1 postfix/qmgr[4846]: 54D258F726: removed

Dec 28 16:10:25 box1 postfix/smtp[23492]: 5CE3E8E133: to=<helpdesk@thisdomain.com>, orig_to=<root>, relay=box2mail.thisdomain.com[10.10.2.75], delay=0, status=sent (250 2.0.0 Ok: queued as 8500358075)
Dec 28 16:10:25 box1 postfix/qmgr[4846]: 5CE3E8E133: removed

I hope it still matters.
Thanks.
--Willie

Last edited by williebens; 12-28-2010 at 05:34 PM.
 
Old 12-28-2010, 05:49 PM   #24
Reuti
Senior Member
 
Registered: Dec 2004
Location: Marburg, Germany
Distribution: openSUSE 15.0
Posts: 1,337

Rep: Reputation: 259Reputation: 259Reputation: 259
Sure, this looks already half-working.

You are already rewriting "to=<root@box1.thisdomain.com>" to "<helpdesk@thisdomain.com>" - correct?

When it's not recipient_canonical, where is this rewritten?

You would now like to convert "<helpdesk@thisdomain.com>" to "<admins@thatdomain.com>" - right?

Can you grep through all files in /etc/postfix where helpdesk pops up? Maybe there is a douple entry for recipient_canonical_maps or alike.
 
Old 12-28-2010, 06:16 PM   #25
williebens
Member
 
Registered: Jan 2008
Posts: 88

Original Poster
Rep: Reputation: 16
Hello Reuti:

This is the result of doing the grep:

/^((dbsupport|helpdesk).*)thisdomain[.]com$/ admins@thatdomain.com

that is the content of the recipient_canonical file.

helpdesk only shows there.

The rewriting comes from an alias in /etc/alias as root: helpdesk@thisdomain. So that is happening.

I really do not want to convert "<helpdesk@thisdomain.com>" to "<admins@thatdomain.com>". What my boss wants is for all emails sent to
helpdesk@thisdomain.com and dbsupport@thisdomain.com to go to admins@thatdomain.com

Thanks.
--Willie

Last edited by williebens; 12-28-2010 at 06:25 PM.
 
Old 12-28-2010, 07:46 PM   #26
Reuti
Senior Member
 
Registered: Dec 2004
Location: Marburg, Germany
Distribution: openSUSE 15.0
Posts: 1,337

Rep: Reputation: 259Reputation: 259Reputation: 259
Well, then Google "postfix forward email" - there are several hits which look promising. But from the philosophical point of view, I would tend to stick to a canonical map (i.e. it's personal taste). In fact, I use this to route emails to sgeadmin (from the queuingsystem) and root to my own account.
 
Old 12-28-2010, 07:51 PM   #27
williebens
Member
 
Registered: Jan 2008
Posts: 88

Original Poster
Rep: Reputation: 16
Hello Reuti:


I am googling about it right now.

I hope to solve this soon.

Thanks a lot for all of your help.


--Willie
 
Old 11-07-2014, 06:29 AM   #28
MiroslavHoudek
LQ Newbie
 
Registered: Nov 2014
Posts: 2

Rep: Reputation: Disabled
Too late but still, I resolved it

I know its way too late, but I had the same problem and resolved it yesterday. The key is to use Postfix Advanced Content Filtering http://www.postfix.org/FILTER_README.html . This is basically a redirect of all mails from Postfix to a different SMTP, which processes the content (header and body) and then it injects the mail back to Postfix. So you basically need to write a complete SMTP server and SMTP client to do this in Postfix - quite ridiculous IMO. But I did it this way, because it was quite simple to achieve in Python.

A simple script that does it is now committed to https://github.com/MiroslavHoudek/postfix-filter-loop . You can get it, start it, configure Postfix (as per Readme on that Github) and do whatever you want with all email via Python scripting.


Quote:
Originally Posted by williebens View Post
Hello Reuti:


I am googling about it right now.

I hope to solve this soon.

Thanks a lot for all of your help.


--Willie
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
Postfix: Rewriting sender email address from ldap lookups endfx Linux - Server 3 04-18-2008 04:53 PM
Postfix: Is it possible to rewrite sender address only for selective recipient? Akhran Linux - Software 3 08-15-2006 11:48 AM
postfix: forcing rewrite of 'To' address when sending imraven Linux - Software 4 06-15-2006 11:07 AM
Postfix - Sender address includes localhost buskmann Linux - Software 1 05-04-2005 08:56 AM
Postfix: Sender address rejected when matching $mydestination [GOD]Anck Linux - Software 1 02-16-2005 06:42 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Server

All times are GMT -5. The time now is 09:35 AM.

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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration