Solved

sendmail: send from multiple hostnames and domains

Posted on 2010-08-16
6
606 Views
Last Modified: 2013-12-18
no mail is received by this linux box, but our developers are using a it to send HTML mail using sendmail
the problem they have is: it always display one and the same host name in the headers and the mail being send is for multiple domains

do I need to setup Sendmail to host multiple domains or can I get away with only reverse mapping as below?
Reverse mapping allows users to send mail from your server and have the correct domain name appended to the outbound e-mail. This feature works almost exactly as the virtusertable, but in reverse. It is done with a “generics table” and requires the following lines be added to sendmail.mc:
FEATURE(`genericstable', `dbm /etc/mail/genericstable')dnl
GENERICS_DOMAIN_FILE(`/etc/mail/generics-domains')dnl

In addition, you will need to create /etc/mail/genericstable, which is just like /etc/mail/virtusertable except that the columns need to be switched so that column one shows the local user name and column two shows the e-mail username and domain name you want that user’s outgoing mail to have. For example:
tom       tom@domain1.com     
harry     harry@domain2.com
tom2      tom@domain2.com

Restart Sendmail, and it should allow you to perform as a virtual mail host for multiple domains. You can usually restart Sendmail by passing it akill –1 [PID of Sendmail] or running /etc/init.d/sendmail restart.

Open in new window

0
Comment
Question by:gddl630
  • 3
  • 3
6 Comments
 
LVL 4

Expert Comment

by:rbdnz
ID: 33446533
Hi,
The hostname is what it is.  You should still be able to send mail from multiple domains regardless.  This is more of a programming issue than a sendmail issue.

Assuming your webserver is colocated on the same box as your sendmail server, in the web scripts you're using you only need to change the "From" address of the mail.  That gets handled in the code. Yes, in the headers it will show the real hostname of your server, but the end user will see the "spoofed" from address in their email client.  

In the event the webserver and the email server are on separate servers, your sendmail instance would have to have the IP address of the webserver as an allowed relay.

Another comment -- even if you could set a different hostname in the headers per mail, an IP address can only have one PTR entry in DNS.  So it would all still come back to a single hostname.  Trying to change a hostname in the headers doesn't really do you any good.  In fact, some spam filters will do a reverse DNS lookup of the IP address connecting to it to make sure it matches the hostname presented in the HELO/EHLO message.



0
 
LVL 1

Author Comment

by:gddl630
ID: 33465880
they are already manipulating the from and return-to addresses so that's OK
as for PTR all mail is going through a gateway, which is allowed in the TXT records in DNS as sender(authorised) and we also use DomainKeys and DKIM authentication so should be fine on the spam side too

the issue I have is that the linux machine is advertising our internal domain name in the headers and that is what I need changed

worth mentioning that all mail is sent from same user on linux and we have no other users setup on the box; mail is however send mail for Multiple(four) domains

it would even suit me if the linux box is configured as cleo.localhost although not sure how this can be done - hostname returns cleo only so where is the attached coming from?
[root@cleo mail]$ dnsdomainname -v
gethostname()=`cleo'
Resolving `cleo' ...
Result: h_name=`cleo.internaldomain.com'
Result: h_aliases=`cleo'
Result: h_addr_list=`10.30.0.93'
internaldomain.com

Open in new window

0
 
LVL 4

Accepted Solution

by:
rbdnz earned 250 total points
ID: 33485676
Ok, that's being sent in the EHLO/HELO message when your sendmail server is relaying through the gateway MTA.  Each MTA hop along the way gets recorded in the headers.

In the sendmail.cf file, there's a section that looks like this:

# my official domain name
# ... define this only if sendmail cannot automatically determine your domain
#Dj$w.Foo.COM

You could uncomment that 3rd line and change to:
Djcleo.localhost
then restart sendmail.

test by 'telnet localhost 25' and you should see something like this:
[root@------ mail]# telnet localhost 25
Trying 127.0.0.1...
Connected to localhost.
Escape character is '^]'.
220 cleo.localhost ESMTP Sendmail 8.14.2/8.14.2; Fri, 20 Aug 2010 00:32:00 -0500
0
What Should I Do With This Threat Intelligence?

Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

 
LVL 1

Author Comment

by:gddl630
ID: 33532829
thanks I did that, but it seems I need to do something else too: i can see cleo.localhost in the headers, but then it is followed by "Received: from cleo.domainname.com" - any idea how can I get rid of that too?
 ironport-gw-i is our edge mail gateway, but it seems the linux server itself is appending the domain name right?

Received: from unknown (HELO cleo.localhost) ([10.30.0.93])
  by ironport-gw-i with ESMTP; 26 Aug 2010 16:21:38 +0100
Received: from cleo.domainname.com (localhost.localdomain [127.0.0.1])
      by cleo.localhost (8.12.11/8.12.11) with ESMTP id o7QFHIbF022067
      for <george@domain.me>; Thu, 26 Aug 2010 16:17:18 +0100
0
 
LVL 4

Expert Comment

by:rbdnz
ID: 33533148
I have some ideas, have to test on a lab server.  Will see if I can get to this today or tomorrow.
0
 
LVL 1

Author Comment

by:gddl630
ID: 33634643
have you been able to test this?
0

Featured Post

Don't lose your head updating email signatures!

Do your end users still have the wrong email signature? Do email signature updates bore you or fill you with a sense of dread? You can make this a whole lot easier on yourself by trusting an Exclaimer email signature management solution. Over 50 million users do...so should you!

Join & Write a Comment

It’s 2016. Password authentication should be dead — or at least close to dying. But, unfortunately, it has not traversed Quagga stage yet. Using password authentication is like laundering hotel guest linens with a washboard — it’s Passé.
This process describes the steps required to Import and Export data from and to .pst files using Exchange 2010. We can use these steps to export data from a user to a .pst file, import data back to the same or a different user, or even import data t…
Learn several ways to interact with files and get file information from the bash shell. ls lists the contents of a directory: Using the -a flag displays hidden files: Using the -l flag formats the output in a long list: The file command gives us mor…
Learn how to get help with Linux/Unix bash shell commands. Use help to read help documents for built in bash shell commands.: Use man to interface with the online reference manuals for shell commands.: Use man to search man pages for unknown command…

746 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now