LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
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 11-04-2017, 05:07 AM   #1
gproietti@gmail.com
LQ Newbie
 
Registered: Nov 2017
Posts: 5

Rep: Reputation: Disabled
Change mail recipient domain on Postfix


Hi,

Recently I changed my FQDN for mail server to a new domain, keeping also possibility to receive email in the old domain.

So, we moved from user@domain1.com to user@domain2.com .
All is working well but I would like to remap incoming mail addresses from @domain1.com to @domain2.com.

I.e. if someone from external sends an email to goofy@domain1.com , I want the user goofy to receive it as addressed to goofy@domain2.com in the TO field.

I tryed to apply a configuration found in this tread :

https://www.linuxquestions.org/quest...n-name-596767/

but it only partially works, as in the received email I find that :

Quote:
X-Original-To: goofy@domain1.com
Delivered-To: goofy@domain2.com
Subject: prova di nuovo
To: goofy@domain1.com
So as the To field is left unchanged the mail client (we use Horde) still showing the old recipient's domain as destination.

My environment is:

Postfix : mail_version = 2.6.6
OS: CentOS 2.6.32-573.22.1.el6.x86_64

Thanks in advance
BR
Giuseppe Proietti
 
Old 11-05-2017, 01:02 AM   #2
descendant_command
Senior Member
 
Registered: Mar 2012
Posts: 1,876

Rep: Reputation: 643Reputation: 643Reputation: 643Reputation: 643Reputation: 643Reputation: 643
Probably you can use header_checks to rewrite the To: header in the message body.
 
Old 11-05-2017, 11:04 AM   #3
gproietti@gmail.com
LQ Newbie
 
Registered: Nov 2017
Posts: 5

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by descendant_command View Post
Probably you can use header_checks to rewrite the To: header in the message body.
Thanks descendant_command , Looking for it, I found this:

http://wiki.bluelightav.org/display/...e+From+headers

Do you know for a good tutorial (and example) for apply header_checks ?

Another possibility I'm considering is to create a my own filter applying the below:

http://www.postfix.org/FILTER_README.html
 
Old 11-05-2017, 01:09 PM   #4
descendant_command
Senior Member
 
Registered: Mar 2012
Posts: 1,876

Rep: Reputation: 643Reputation: 643Reputation: 643Reputation: 643Reputation: 643Reputation: 643
Actually, your original method should change the To: in the body as well.
Quote:
Canonical address mapping

The cleanup(8) daemon uses the canonical(5) tables to rewrite addresses in message envelopes and in message headers. By default all header and envelope addresses are rewritten; this is controlled with the canonical_classes configuration parameter.
Maybe you need to look at this directive:
Quote:
canonical_classes (default: envelope_sender, envelope_recipient, header_sender, header_recipient)

What addresses are subject to canonical_maps address mapping. By default, canonical_maps address mapping is applied to envelope sender and recipient addresses, and to header sender and header recipient addresses.

Specify one or more of: envelope_sender, envelope_recipient, header_sender, header_recipient
 
Old 11-06-2017, 11:06 AM   #5
gproietti@gmail.com
LQ Newbie
 
Registered: Nov 2017
Posts: 5

Original Poster
Rep: Reputation: Disabled
Thanks, I'll try it tomorrow in the evening, during a maintenance window.
 
Old 11-07-2017, 11:51 PM   #6
gproietti@gmail.com
LQ Newbie
 
Registered: Nov 2017
Posts: 5

Original Poster
Rep: Reputation: Disabled
Hi,

I added the canonical_classes option but behaviour is not changing.

Quote:
recipient_canonical_maps = hash:/etc/postfix/myrecipientmap
canonical_classes=envelope_sender, envelope_recipient, header_sender, header_recipient
It changed the Delivered-To: field but the To: field remains with the original address
 
Old 11-08-2017, 12:37 AM   #7
descendant_command
Senior Member
 
Registered: Mar 2012
Posts: 1,876

Rep: Reputation: 643Reputation: 643Reputation: 643Reputation: 643Reputation: 643Reputation: 643
Don't know why - maybe implemented in a later version than yours.

Did you try the header_checks methid?
http://www.postfix.org/header_checks.5.html

A custom content filter seems like overkill and a lot of work and shouldn't be necessary.
 
  


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
Postfix recipient adding host@domain when using aliases MensaWater Linux - Software 6 06-27-2014 08:27 AM
Postfix: redirect e-mail based on Sender and Recipient andy2008 Linux - Software 6 07-14-2011 08:36 AM
Rejecting mail where sender matches recipient in postfix Gethyn Linux - Server 3 08-23-2009 10:51 AM
E-mail FROM domain change -postfix rush_pl Linux - Server 6 12-22-2006 08:41 AM

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

All times are GMT -5. The time now is 06:01 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
Open Source Consulting | Domain Registration