Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

multiple domain names and email addresses

Posted on 1998-08-21
11
Medium Priority
?
308 Views
Last Modified: 2010-04-22
Heya all..

I have a mail server here with more than one domain name.
I want to be able to receive email via info@domainname.com for each domain.  at the moment, they all goto the main domain name.  How do I setup virtual domain emails?  even if it's just aliasing of some kind.  what is the best way to do this?
0
Comment
Question by:Q010797
  • 5
  • 2
  • 2
  • +2
11 Comments
 
LVL 1

Expert Comment

by:RoboBob
ID: 1637838
If you are using sendmail as your mail server, there are instructions for setting up virtual domains at http://www.sendmail.org/virtual-hosting.html
0
 
LVL 1

Author Comment

by:Q010797
ID: 1637839
That's a little more of a complicated answer than I wanted.  Can't you just give me some example files and what to type where and how?
0
 
LVL 1

Expert Comment

by:RoboBob
ID: 1637840
Its a complicated answer because its a complicated question, any example configuration would have to be modified to fit your specific installation anyway...
0
Get free NFR key for Veeam Availability Suite 9.5

Veeam is happy to provide a free NFR license (1 year, 2 sockets) to all certified IT Pros. The license allows for the non-production use of Veeam Availability Suite v9.5 in your home lab, without any feature limitations. It works for both VMware and Hyper-V environments

 
LVL 1

Author Comment

by:Q010797
ID: 1637841
well can you give me an example config that all I have to do is put the domain in the right spot?  you already know I only have 2 domains and want the examples with sendmail 8.8.8 and linux 2.0
0
 
LVL 1

Expert Comment

by:bryanjones
ID: 1637842
The best way to do this is placing each and every domainname in the sendmail.cw file.

EXAMPLE: .....
idiot.com
killer.com
boo.com

All these entries in the sendmail.cw file
0
 
LVL 1

Author Comment

by:Q010797
ID: 1637843
that's not what I want.  I want (on the same mail server) the two email addresses kept seperate

info@domain1.com
info@domain2.com

how do I do this?
0
 
LVL 4

Expert Comment

by:feenix
ID: 1637844
One solution is the following:
Create accounts info-1, info-2, info-3 etc. Then write to /etc/mail/aliases (or where ever that file is in your system) the following lines:
info@domain1.com:  info-1
info@domain2.com:  info-2
info@domain3.com:  info-3
etc for all the domains. Then run newaliases and you're done. All the different domains should have separate info-account.
0
 
LVL 1

Author Comment

by:Q010797
ID: 1637845
nah that was the FIRST thing I tried... the mail arrives in the info@domain1 account no matter which one I try and send it to.
0
 
LVL 1

Expert Comment

by:dirge
ID: 1637846
Hi, again, Q. Please provide the ff:

1. Sendmail version (I suggest using 8.9.x as it has some stuff to make this easier)

2. Does your /etc/sendmail.cf contain something like:

  Kvirtuser hash -o /etc/virtusertable

? If so you're halfway there. If not, well, you really ought to check out the URL RoboBob provided. (Actually you should read it in any case...)

3. Do you have different IPs for the domains? If so, do you have DontProbeInterfaces setup as an option in your sendmail.cf?

I may have a few more questions depending on your answers to these. All for now...!
0
 
LVL 1

Author Comment

by:Q010797
ID: 1637847
am using sendmail 8.8.8

no it doesn't have the above Kvirtuser line.  The only Kvirtuser line is :

#Kvirtuser dbm /etc/virtusertable
as you can see it's # out anyway.

The domains all share the same IP range.
0
 
LVL 1

Accepted Solution

by:
dirge earned 300 total points
ID: 1637848
Well, then, that's the problem. It looks like your sendmail.cf configuration isn't setup properly for virtual domains.

Putting "info@domain1.com info-1" in the /etc/aliases file is NOT good enough. You need to create an /etc/virtusertable.db (or .dir/.pag, whatever) database containing the virtual domain mappings. READ THROUGH BEFORE TRYING.

Step 1. Create "info-1", "info-2", etc. accounts, to be used for each domain.

Step 2. cd to /etc. Create /etc/virtusertable as a text file like so:

info@domain1.com  info-1
info@domain2.com  info-2
info@domain3.com  info-3

Step 3. Run "makemap hash /etc/virtusertable" or "makemap dbm /etc/virtusertable" ("hash" is more or less available on all Linux systems)

If you don't have makemap ("locate makemap", "which makemap") on your system, try this quick-and-dirty Perl script that simulates "makemap hash":

#!/usr/bin/perl
# Edit first line to point to your perl binary

use AnyDBM_File;

open(FILE,"/etc/virtusertable");
dbmopen(%vusers,"/etc/virtusertable",0644);
while(chomp($line=<FILE>)) {
   next if ($line eq "") || $line=~/^\#/;
   ($addr,$user)=split(" ",$line);
   $vusers{$addr}=$user;
}
dbmclose(%vusers);
close(FILE);

Step 4. Edit sendmail.cf as follows:

4a. If you used "hash" (or the script) above, use the line

Kvirtuser hash /etc/virtusertable

Use "dbm" instead of "hash" if you successfully managed to use "makemap dbm"

4b. Make sure that you have lines in your sendmail.cf analogous to:

# handle virtual users
R$+ < @ $=w . >         $: < $(virtuser $1 @ $2 $@ $1 $: @ $) > $1 < @ $2 . >
R<@> $+ + $* < @ $* . > $: < $(virtuser $1 + * @ $3 $@ $1 $: @ $) > $1 + $2 < @ $3 . >
R<@> $+ + $* < @ $* . > $: < $(virtuser $1 @ $3 $@ $1 $: @ $) > $1 + $2 < @ $3 . >
R<@> $+ < @ $+ . >      $: < $(virtuser @ $2 $@ $1 $: @ $) > $1 < @ $2 . >
R<@> $+                 $: $1
R< error : $- $+ > $*   $#error $@ $(dequote $1 $) $: $2
R< $+ > $+ < @ $+ >     $: $>97 $1

Tabs separate the left and right sides ($:, $#) of the lines, not spaces.

5. Edit your /etc/sendmail.cw file (assuming there is a line like "Fw/etc/sendmail.cw" in your sendmail.cf) to contain all the domain names, one per line.

6. Send a HUP signal to sendmail, e.g. "kill -HUP `cat /var/run/sendmail.pid`" (assuming there IS a /var/run/sendmail.pid. If not, "ps ax | grep sendmail", choose lowest PID to kill -HUP. Also, those are backticks, not single quotes.) Sorry if you already know this, but it seemed best to be sure.

Try it. If it doesn't work, you may be having any of the following problems:

a. If you're getting "Mail loops back to me":

  - MX entries (in your DNS) may not be setup properly
  - You may need to add/uncomment "Djyourdomain.com" in your sendmail.cf

b. Sendmail tries to optimize by considering email to a domain that resolves to the same physical machine as belonging to the "root" domain. SOLUTION: you may have to patch sendmail especially since you are not using the latest version. Leave a comment here if you need the patch (I'll have to look for it.) ALTERNATIVE: Upgrade to sendmail 8.9.x and uncomment/add "DontProbeInterfaces" to your sendmail.cf.

Don't forget to restart sendmail.

If you really want to have "info" as the POP/IMAP username on all domains, you'll have to go through the trouble of either using virtuald (see Linux Virtual Services HOWTO), or creating a specialized mailer for sendmail and patching your POP3 daemon.

I hope this helps...
0

Featured Post

Nothing ever in the clear!

This technical paper will help you implement VMware’s VM encryption as well as implement Veeam encryption which together will achieve the nothing ever in the clear goal. If a bad guy steals VMs, backups or traffic they get nothing.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I have written articles previously comparing SARDU and YUMI.  I also included a couple of lines about Easy2boot (easy2boot.com).  I have now been using, and enjoying easy2boot as my sole multiboot utility for some years and realize that it deserves …
This article will show you step-by-step instructions to build your own NTP CentOS server.  The network diagram shows the best practice to setup the NTP server farm for redundancy.  This article also serves as your NTP server documentation.
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…
How to Install VMware Tools in Red Hat Enterprise Linux 6.4 (RHEL 6.4) Step-by-Step Tutorial
Suggested Courses
Course of the Month9 days, 22 hours left to enroll

926 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