Solved

multiple domain names and email addresses

Posted on 1998-08-21
11
295 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
Microsoft Certification Exam 74-409

Veeam® is happy to provide the Microsoft community with a study guide prepared by MVP and MCT, Orin Thomas. This guide will take you through each of the exam objectives, helping you to prepare for and pass the examination.

 
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 150 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

Complete VMware vSphere® ESX(i) & Hyper-V Backup

Capture your entire system, including the host, with patented disk imaging integrated with VMware VADP / Microsoft VSS and RCT. RTOs is as low as 15 seconds with Acronis Active Restore™. You can enjoy unlimited P2V/V2V migrations from any source (even from a different hypervisor)

Question has a verified solution.

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

How many times have you wanted to quickly do the same thing to a list but found yourself typing it again and again? I first figured out a small time saver with the up arrow to recall the last command but that can only get you so far if you have a bi…
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é.
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…
Learn how to navigate the file tree with the shell. Use pwd to print the current working directory: Use ls to list a directory's contents: Use cd to change to a new directory: Use wildcards instead of typing out long directory names: Use ../ to move…

828 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