Question

Postfix Virtual Domains setup

Asked by: ashuji

Hi

I am configuring postfix server to send mail for 8 differnet domains.  I configured it using virtual_alias_domains and virtual_alias_maps parameters.  I am able to send mail as FROM any of these 8 domains.  

I am facing issue with the header of mail being sent from any of the virtual domain, please refer to the header of one of the mail as below:

Please refer to the 7th line in the header:
"Received: from CentOS52.localdomain ([<my public IP>])"

CentOS52.localdomain is the hostname of the system postfix is hosted on.

If I am sending from domain tmails.com then why is it showing hostname "CentOS52.localdomain " in the header, is there any way to replace hostname in the header with the domain name.

like if I am sending mail as ashwani@tmails.com then it should show in header at 7th line:

"Received: from tmails.com ([<my public IP>])"

and if the second virtual domain configured in my postfix is "xmails" and if I am sending mail as ashwani@xmails.com then it should show in header at 7th line:

"Received: from xmails.com ([<my public IP>])"


Header:
Delivered-To: ashuji@gmail.com
Received: by 10.220.74.19 with SMTP id s19cs55809vcj;
        Wed, 10 Jun 2009 11:33:24 -0700 (PDT)
Received: by 10.142.232.7 with SMTP id e7mr637135wfh.164.1244658804206;
        Wed, 10 Jun 2009 11:33:24 -0700 (PDT)
Return-Path: <ashwani@tmails.com>
Received: from CentOS52.localdomain ([<my_public_IP>])
        by mx.google.com with SMTP id 3si1551335pzk.134.2009.06.10.11.33.22;
        Wed, 10 Jun 2009 11:33:23 -0700 (PDT)
Received-SPF: fail (google.com: domain of ashwani@tmails.com does not designate <my_public_IP> as permitted sender) client-ip=<my_public_IP>;
Authentication-Results: mx.google.com; spf=hardfail (google.com: domain of ashwani@tmails.com does not designate <my_public_IP> as permitted sender) smtp.mail=ashwani@tmails.com
Received: from indiaws145 (unknown [192.168.2.72])
      by CentOS52.localdomain (Postfix) with SMTP id CD778781E5
      for <ashuji@gmail.com>; Thu, 11 Jun 2009 00:03:19 +0530 (IST)
Message-ID: <6A5120BB1FEC46B9AA851EA2DC295A62@rapidcorp.com>
Reply-To: "Ashwani Jain" <ashwani@tmails.com>
From: "Ashwani Jain" <ashwani@tmails.com>
To: <ashuji@gmail.com>
Subject: Test-5
Date: Thu, 11 Jun 2009 00:03:14 +0530
MIME-Version: 1.0
Content-Type: multipart/alternative;
      boundary="----=_NextPart_000_005D_01C9EA28.03CC93A0"
X-Priority: 3
X-MSMail-Priority: Normal
X-Mailer: Microsoft Outlook Express 6.00.2900.5512
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.5579

This is a multi-part message in MIME format.

------=_NextPart_000_005D_01C9EA28.03CC93A0
Content-Type: text/plain;
      charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

hi!
------=_NextPart_000_005D_01C9EA28.03CC93A0
Content-Type: text/html;
      charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=3DContent-Type content=3D"text/html; =
charset=3Diso-8859-1">
<META content=3D"MSHTML 6.00.6000.16825" name=3DGENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=3D#ffffff>
<DIV><FONT face=3DArial size=3D2>hi!</FONT></DIV></BODY></HTML>

------=_NextPart_000_005D_01C9EA28.03CC93A0--

This Question has been solved and asker verified All Experts Exchange premium technology solutions are available to subscription members.

Subscribe now for full access to Experts Exchange and get

Instant Access to this Solution

  • Plus...
  • 30 Day FREE access, no risk, no obligation
  • Collaborate with the world's top tech experts
  • Unlimited access to our exclusive solution database
  • Never be left without tech help again

Subscribe Now

Asked On
2009-06-10 at 13:08:35ID24480875
Tags

Postfix on Cent OS 5

Topics

Postfix

,

Email Servers

,

Linux

,

CentOS

Participating Experts
2
Points
500
Comments
26

Trusted by hundreds of thousands everyday for fast, accurate and reliable tech support.

  • "The time we save is the biggest benefit of Experts Exchange to Warner Bros. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange." Mike Kapnisakis, Warner Bros.
  • "Our team likes having a resource that is more secure than just using Google and most experts using this service really know their stuff. It's nice to look here first versus using Google." Dayna Sellner, Lockheed Martin
  • "Anytime that I've been stumped with a problem, 9 out of 10 times Experts Exchange has either the accepted solution or an open discussion of the potential solution to the problem." Kenny Red, eBay Inc.

See what Experts Exchange can do for you.

Got a question?

We've got the answer.

Experts Exchange has been collecting answers to technology questions since 1996…3 million and counting! If you have a question, chances are we already have your answer.

Screenshot of Experts Exchange Knowledgebase

Need individual assistance?

Our experts are ready to help.

If you can't find the exact answer you're looking for, ask our exclusive community of 50,000 experts. You’ll get a personalized answer from a trusted professional.

Screenshot of Experts Exchange Knowledgebase

Want to learn from the best?

Read articles from industry experts.

Thousands of free tech tips, tricks, how-to’s and tutorials are available in our peer reviewed articles section. See for yourself how smart our experts are, no login required.

Screenshot of an Article

Working on a long term project?

Store your work and research.

Save solutions to your questions, answers you’ve discovered through searching plus helpful articles in your personal knowledgebase for easy future access.

Screenshot of Experts Exchange Knowledgebase

Access the answers to your technology questions today.

Subscribe Now

30-day free trial. Register in 60 seconds.

What Makes Experts Exchange Unique?

Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Trusted by the world's most respected brands.

image of each brand's logo

Faithfully serving IT professionals since 1996.

Experts Exchange Logo

Try it out and discover for yourself.

Subscribe Now

30-day free trial. Register in 60 seconds.

Related Solutions

  1. Postfix - Relaying
    I currently have a web server configured with Apache, BIND, Postfix, VM-Pop3d and all that wizzwozz and have just successfully got Postfix working correctly with pop-before-smtp (PERL), i'm having trouble with relaying though. I have a list of IP Addresses and domain names w...
  2. Valid SPF
    I have two domains and I want to make a valid spf for both: 1. firstdomain.co.uk [66.249.91.89] 2. seconddomain.com [206.190.60.37] firstdomain.co.uk is only sending email from exchange server second domain is sending email from exchange server and also from website (...

Free Tech Articles

  1. WARNING: 5 Reasons why you should NEVER fix a computer for free.
    It is in our nature to love the puzzle. We are obsessed. The lot of us. We love puzzles. We love the challenge. We thrive on finding the answer. We hate disarray. It bothers us deep in our soul. W...
  2. SCCM OSD Basic troubleshooting
    SCCM 2007 OSD is a fantastic way to deploy operating systems, however, like most things SCCM issues can sometimes be difficult to resolve due to the sheer volume of logs to sift through and the dispe...
  3. Migrate Small Business Server 2003 to Exchange 2010 and Windows 2008 R2
    This guide is intended to provide step by step instructions on how to migrate from Small Business Server 2003 to Windows 2008 R2 with Exchange 2010. For this migration to work you will need the fo...
  4. Create a Win7 Gadget
    This article shows you how to create a simple "Gadget" -- a sort of mini-application supported by Windows 7 and Vista. Gadgets can be dropped anywhere on the desktop to provide instant information, ...
  5. Outlook continually prompting for username and password
    There have been a lot of questions recently regarding Outlook prompting for a username and password whilst using Exchange 2007. There are a few reasons why this would happen and I will try to cover t...
  6. Backup Exchange 2010 Information Store using Windows Backup
    There seems to be quite a lot of confusion around the ability to backup Exchange 2010 using the built in Windows Backup feature. This stems from the omission of this feature prior to Exchange 2007 s...

Cloud Class Webinars

  1. Avoiding Bugs in Microsoft Access
    Alison Balter takes and in-depth look at avoiding bugs in Access. In this webinar you will learn about using the immediate window to debug your applications, invoking the debugger, using breakpoints to troubleshoot, stepping through code, setting the next statement to execute, ...
  2. Top 10 Best New Features in Visio 2010
    Scott Helmers gives live demonstrations of the top 10 new features in Visio 2010. This webinar will teach you how to create compelling diagrams by adding shapes to the page with a single click, linking the shapes in a diagram to data in Excel (or SQL Server, or SharePoint), ...
  3. IT Consultant Business Secrets Revealed
    Michael Munger, Experts Exchange tech pro and IT consultant, pulls back the curtain on his very successful businesses and answers question on every IT consultant and business owner should know about. He shares secrets on what he did to solve the 5 most common problems in IT, ...
  4. Disaster Recovery and Business Continuity
    Quest CTO, Mike Billon, gives an overview of the steps involved in building a dunamic disaster recovery plan. Through case studies and an examination of software/hardware tooles for monitoring and testing, you'll gain a better understandin of where you are, where you want ...
  5. Organize Your Visio Diagrams with Containers and Lists
    Scott Helmers uses cross functional flowcharts, wireframe diagrams, data graphic legends and seating charts to teach you: how to ustilize all three new structured diagram components in Visio 2010, the best practices for organizeing shapes in previous version of Visio, how to organize ...
  6. How to Us Objects, Properties, Events and Methods in Microsoft Access
    Alison Dalter gives an in-depbth look at objects, properties, events and methods in Microsoft Access. In this webinar you will learn about using the object browser, referring to objects, working with properties and methods, working with object variables, understanding the ...

Join the Community

Give a Little. Get a Lot.

Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.

Join the Community

Answers

 

by: oklitPosted on 2009-06-11 at 05:34:47ID: 24601384

May I ask why do you want to change this?
This is name of your server (set in myhostname). Postifx uses this to introduce itself to other SMTP servers.
This is controlled by smtp_helo_name option (which is by default set to $myhostname). You may try to change it dynamically with some transports probably, but I really don't see any reason for this (if you have some - please write it - maybe there is some other, easier, more elegant solution).

 

by: ashujiPosted on 2009-06-11 at 05:53:34ID: 24601576

I am going to host around 8 mail domains on this server and want only domian names (tmail/xmails etc) to appear in header and don't want HOSTNAME to appear any where in header

Kindly help to to configure this parameter (smtp_helo_name) dynamicaly so that everytime SMTP talk to other SMTP it tells mail domain name instead of hostname.

Thanks & regards

Ashwani Jain

 

by: arnoldPosted on 2009-06-11 at 06:57:12ID: 24602311

Usually a system that email hosts domains deals with inbound email.
The complexity is that the process has to determine what the sender's domain name is and then alter the SMTP greeting.  Do you also have multiple hostnames associated with the IP of the mail server?  If you do not, the SMTP connection could be rejected if the greeting says hi host.domain1.com while the IP resolves to host.someotherdomain.com.

You should check the FAQ at www.postfix.org to see if what you want is supported.

I do not know whether the below will do what you want:
http://www.postfix.org/postconf.5.html#sender_dependent_relayhost_maps

 

by: ashujiPosted on 2009-06-11 at 08:20:28ID: 24603409

OK, On my server I have 8 virtual NIC port eth0:0-eth0:7.  Each has different private IP natted with some public IP.  Each public IP resolves to different sender domain like for example for private IP on eth0:0 its natted public IP resolves to tmails.com and or private IP on eth0:1 its natted public IP resolves to xmails.com and so on for each private IP.

I am also using follwing config in master.cf to allow clients to communiate with sending domains on each private IP:

localhost:smtp  inet n - n - - smtpd
10.13.0.208:smtp inet n - n - - smtpd
10.13.0.211:smtp inet n - n - - smtpd -o myhostname=tmails.com
10.13.0.209:smtp inet n - n - - smtpd -o myhostname=xmails.com

After the above config, I am able to send mails to gmail.com accounts successfully.  And header of the mail received is similar to one I posted in my question.

So answer to your question is yes using above config in master.cf i have multiple hostnames associated with each IP address.  Means each IP address has different hostname.  


 

by: arnoldPosted on 2009-06-11 at 09:39:16ID: 24604273

I think you are missing the point.  You seem to be trying to provide the illusion that each domain has its own dedicated mail server. To what end?

You could try to define a relay host (reference the link posted in prior comment) that will redirect/relay emails sent by user@tmail.com to/through 10.13.0.211 and see whether  header entry on the outgoing side matches the sender's email.

 

by: oklitPosted on 2009-06-11 at 10:05:46ID: 24604522

Ok, so you have myhostname set dynamically in master.cf - do the same with smtp_helo_name.
Then, you just have to make sure that your emails are sent via proper smtp processes (which are bound to specific ip addresses) - you can do this for example with proper transport maps.

 

by: ashujiPosted on 2009-06-11 at 10:54:39ID: 24604943

Yes!  Your guess is correct, I am trying to provide the illusion that each domain has its own dedicated mail server.  I just tried to use the relay host as below but it did not solve the problem:

in master.cf added entry:
10.13.0.210:smtp inet n - n - - smtpd -o myhostname=sending_domain.com -o sender_dependent_relayhost_maps=hash:/etc/postfix/sender_relay

Contents of /etc/postfix/sender_relay
@sending_domain.com sending_domain.com

service postfix restart

But even after this, its still showing hostname in header instead of sending domain.

 

by: ashujiPosted on 2009-06-11 at 11:47:47ID: 24605480

I tried below line in master.cf but it did not make any difference:

localhost:smtp  inet n - n - - smtpd
10.13.0.208:smtp inet n - n - - smtpd
10.13.0.211:smtp inet n - n - - smtpd -o myhostname=sending_domain.1.com

10.13.0.209:smtp inet n - n - - smtpd -o myhostname=sending_domain.2.com

10.13.0.210:smtp inet n - n - - smtpd -o myhostname=sending_domain.3.com

10.13.0.215:smtp inet n - n - - smtpd -o myhostname=sending_domain.4.com

10.13.0.212:smtp inet n - n - - smtpd -o myhostname=sending_domain.5.com

10.13.0.216:smtp inet n - n - - smtpd -o myhostname=sending_domain.6.com

10.13.0.214:smtp inet n - n - - smtpd -o myhostname=sending_domain.7.com -o smtp_helo_name=sending_domain.7.com


Still the header is like as below:



Delivered-To: ashuji@gmail.com
Received: by 10.220.74.19 with SMTP id s19cs163142vcj;
       Thu, 11 Jun 2009 11:39:36 -0700 (PDT)
Received: by 10.114.190.6 with SMTP id n6mr4417515waf.133.1244745575349;
       Thu, 11 Jun 2009 11:39:35 -0700 (PDT)
Return-Path: <dan@test_domain.com>
Received: from mail.<myhostname> (<myhostname> [<my_public_ip>])
       by mx.google.com with ESMTP id 28si756790pzk.61.2009.06.11.11.39.34;
       Thu, 11 Jun 2009 11:39:34 -0700 (PDT)
Received-SPF: neutral (google.com: <my_public_ip> is neither permitted nor denied by best guess record for domain of dan@test_domain.com) client-ip=<my_public_ip>;
Authentication-Results: mx.google.com; spf=neutral (google.com: <my_public_ip> is neither permitted nor denied by best guess record for domain of dan@test_domain.com) smtp.mail=dan@test_domain.com
Received: from <myhostname> (unknown [10.13.0.1])
   by sending_domain.7.com (Postfix) with ESMTP id C160B980A7
   for <ashuji@gmail.com>; Thu, 11 Jun 2009 14:39:33 -0400 (EDT)
To: ashuji@gmail.com
Subject: Test Email System
Message-ID: <5067428837adb32d05ecd524799eafac@<myhostname>>
Date: Thu, 11 Jun 2009 14:39:33 -0400
From: <dan@test_domain.com>
Reply-To: dan@test_domain.com
MIME-Version: 1.0
Content-Type: text/plain; format=flowed; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

Hi,
This is a test of the emailing system. If you received this ok, then
everything is working as it should.


My intenet is to replace the occurance of myhostname with sender_domain.

 

by: arnoldPosted on 2009-06-11 at 11:50:58ID: 24605516

The issue with what you want to do means that the users have to use your mail server as the outgoing SMTP.  Does each user use the IP that corresponds to their "dedicated mailserver"
I.e. user@tsmail.com uses the public IP that is mapped to the SMTP service that has the myhostname=tsmail.com.

I think that to provide the illusion of having a dedicated mail server you are wasting the limited public IP resources you have.

Are the users for whom you provide mail services use you as the outgoing ISP?  It is likely that the outgoing email those users send goes through their ISP's mail servers.

The creation of an illusion is much more complex.  Note the Message-ID which references the radicorp.com domain.  On a dedicated server, the Message-ID would reflect the tsmail.com domain or the mail server's hostname.
post the contents of the sender_relay as well as the new header.

One other thing to try is look at /etc/hosts. Do you have an entry such as
10.13.0.211 tmails.com

 

by: ashujiPosted on 2009-06-11 at 11:52:37ID: 24605539

If refer to link http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=325991, according to this link I need to have following entry in master.cf smtp_use_tls = yes in order to make smtp_helo_name effective.  
Please suggest ?


 

by: ashujiPosted on 2009-06-11 at 12:01:25ID: 24605613

I added following entry in /etc/hosts

10.13.0.214 sending_domain.7.com

THen again sent email from the Email client which is using this mail server as SMTP for outgoing, but still no change, still the header is same.

 

by: ashujiPosted on 2009-06-11 at 12:11:19ID: 24605715

One more thing, do you think it has something to do with DNS:

If forward lookup for domain name sender_domain.7.com is a.a.a.a and reverse lookup of a.a.a.a is equvalant to myhostname.  

Because mail recipient server for same domain is different and mail sending server form same domain is my machine.




 

by: ashujiPosted on 2009-06-11 at 12:15:56ID: 24605766

No, I was wrong at this part, REV and FORWARD lookup is OK for this particular domain.

 

by: arnoldPosted on 2009-06-11 at 13:13:37ID: 24606356

The DNS does not controll the greeting your server issues during the connection.
The option you define for the inbound connections are the the same as the process used to send the messages out.
I.e. you have setup eight doors to enter your server with each door representing a different entity.  The problem is can you direct the outgoing message through a specific door.

TLS deals with Enrypted data exchange.

Do the people for whom you handle the inbound emails use your server to send their emails out?

 

by: ashujiPosted on 2009-06-11 at 14:09:18ID: 24606898

OK, we use this server only for sending out broadcasting mails and receive bounce messages if any.

We use separeate email client to use this server as SMTP to send out bulk mails form different domains.

 

by: arnoldPosted on 2009-06-11 at 20:17:56ID: 24608883

I am unsure of postfix' mechanism to alter the greeting based on the sender.  The email delivery is handled through qmgr.

 

by: ashujiPosted on 2009-06-12 at 08:58:46ID: 24613511

As suggested by oklit, using smtp_helo_name we can change the the greeting based on sender.  Do you have some Idea about it ?

Or if you could guide me on how to play with qmgr to change it ?

Regards

Ashwani Jain

 

by: arnoldPosted on 2009-06-13 at 09:22:27ID: 24619733

Unfortunately, I do not.

 

by: oklitPosted on 2009-06-15 at 15:55:32ID: 24633735

> 10.13.0.214:smtp inet n - n - - smtpd -o myhostname=sending_domain.7.com -o smtp_helo_name=sending_domain.7.com
I missed one important thing - smtp_helo_name is not valid option for smtpd, so above cannot work.

I think the only way you can achieve this, is to run multiple instances of postfix, each one with different config file (-c option for postfix binary). In such case, you may also need to use separate queue directory for each instance (queue_directory option to set in main.cf).

 

by: ashujiPosted on 2009-06-16 at 11:24:50ID: 24640796

Do you think hosing multiple several postifix instances on same host will solve this problem.  I think hostname will remail same for all instances of Postfix and same hostname will appear in header send from any postfix instance.

 

by: oklitPosted on 2009-06-16 at 12:19:04ID: 24641433

Just set different smtp_helo_name in configuration files for each instance.

 

by: arnoldPosted on 2009-06-16 at 15:16:17ID: 24643145

Are the lengths you are going through worth it?
The multiple instance is the only way to insure that the Message-ID and the outgoing greeting will match the sender's domain.


 

by: ashujiPosted on 2009-06-16 at 15:19:50ID: 24643176

OK, Thanks a lot for your precious time.  I am gonna test it tomorrow and update the status here.

Thanks & regards
ASHU

 

by: ashujiPosted on 2009-09-16 at 06:36:36ID: 31629409

Problem was resolved after editing sendmail.cf file with following:

localhost:smtp  inet n - n - - smtpd
10.13.0.208:smtp inet n - n - - smtpd
10.13.0.214:smtp inet n - n - - smtpd -o myhostname=connect.domain1_name.com -o smtp_helo_name=connect.domain1_name.com
10.13.0.211:smtp inet n - n - - smtpd -o myhostname=domain2_name.com
10.13.0.209:smtp inet n - n - - smtpd -o myhostname=connect.domain3_name.com

20120131-EE-VQP-002

3 Ways to Join

30-Day Free Trial

The Experts

98% positive feedback on 31,087 answers since March 2000. angeliii is a Microsoft Most Valuable Professional for his work with MS SQL Server & Develoment.

He has also proven his knowledge of Visual Basic Programming, PHP Scripting and Oracle Databases.

The Experts

97% positive feedback on 10,752 answers since July 2000. lrmoore has more than 18 years experience in the networking industry.

The six-time Mircosoft MVPs specialties include firewalls, virtual private networking, and network management.

Testimonials

"...and excellent source for support... Kind of like having your very own IT dept." Electriciansnet

Testimonials

"I was apprehensive at signing up at first. However... it has already made my life as an IT administrator much easier." JaCrews

Testimonials

"WOW! You guys have great, active, and knowledgeable people on here." moore50

Business Clients

Business Clients

In the Press

"If you’ve got a question... Experts Exchange can supply an answer.”

In the Press

"...an invaluable aid for both IT professionals and those who require tech support."

In the Press

"where IT professionals provide quick answers on just about any topic"

Business Account Plans

Loading Advertisement...