1834705 Members
2316 Online
110069 Solutions
New Discussion

sendmail - two domains?

 
Fred Martin_1
Valued Contributor

sendmail - two domains?

I have one HP9000/10.20 box that serves two companies in the same building.

Can sendmail serve two different domain names? To complicate things, specific users work for each company. So when john sends email out, it should appear to be from john@domain1.com, but harry's mail should appear to be from harry@domain2.com.

Is this possible, or should I just put Linux on a PC and set up sendmail to serve the second domain?
fmartin@applicatorssales.com
17 REPLIES 17
Kofi ARTHIABAH
Honored Contributor

Re: sendmail - two domains?

For incoming mail, sendmail does not care what the domain name it is destined for is - that is decided by dns: specifically, the mx records for the domain. So the mx records for domain1.com and domain2.com can be the same IP address and it will work.

For outgoing mail, how are your john and harry sending their mails? are they logged onto the HP box or are they sending from a PC. If its from a PC then its a question of configuring the PC with the details of THEIR account (ie. domain name etc.)

Good luck
nothing wrong with me that a few lines of code cannot fix!
Fred Martin_1
Valued Contributor

Re: sendmail - two domains?

Actually it's a mixed bag. I have users logged into unix, and some POP in to get mail from PCs. I'm not sure if Pine for HP-UX can be config'd to declare the reply address as being something other than the real domain. I'm pretty sure most PC mail packages can be.
fmartin@applicatorssales.com
Kofi ARTHIABAH
Honored Contributor

Re: sendmail - two domains?

you can configure the "from" address with :

mailx -s "subject" -r john@domain1.com receipients....

I am not sure about the same in pine.
nothing wrong with me that a few lines of code cannot fix!
Alan Riggs
Honored Contributor

Re: sendmail - two domains?

I believe that the ability to alter the "from" address in sendmail is restricted to the root user as a security feature.

I do not know of any way to open this privelidge to a non-root user, but I have never tried, either. I think that the security concerns behind limiting address spoofing are legitimate.
Kofi ARTHIABAH
Honored Contributor

Re: sendmail - two domains?

Fred, I know that in linux, the file $HOME/.pinerc contains a variable called user-domain you can set this to whatever you want.

user-domain="domain1.com"

cheers.
nothing wrong with me that a few lines of code cannot fix!
alberto vasquez
Trusted Contributor

Re: sendmail - two domains?


How to use the mailertable functionality in Sendmail to check specific domain names and route them through different relay boxes
in 8.8 and above in non-DNS environment where the there is already one DS entry.
1. uncomment the following line in sendmail.cf:
Kmailertable dbm /etc/mail/mailertable

2. find and uncomment the following section in sendmail.cf:

# not local -- try mailer table lookup
R$* <@ $+ > $* $: < $2 > $1 < @ $2 > $3 extract host name
R< $+ . > $* $: < $1 > $2 strip trailing dot
R< $+ > $* $: < $(mailertable $1 $) > $2 lookup
R< $~[ : $+ > $* $>95 < $1 : $2 > $3 check -- resolved?
R< $+ > $* $: $>90 <$1> $2 try domain

3. find and uncomment Ruleset 90: S90
R$* <$- . $+ > $* $: $1$2 < $(mailertable $3. $@ $1$2 $@ $2 $) > $4

4. cd /etc/mail

5. vi mailertable
domain2check.com smtp:the_new_relay.com

6. makemap dbm mailertable < mailertable

7. /sbin/init.d/sendmail stop
8. /sbin/init.d/sendmail start

Berlene
Fred Martin_1
Valued Contributor

Re: sendmail - two domains?

Ok, if I have the DNS set so that MX records bound for domain1.com -and- domain2.com are both going to the same sendmail server, do I need to do anything to the server so that it recognizes both? I'm referring to sendmail.cf or sendmail.cw, I guess.
fmartin@applicatorssales.com
Kofi ARTHIABAH
Honored Contributor

Re: sendmail - two domains?

Yes, you will have to add the other domain name to the /etc/mail/sendmail.cw file and then restart sendmail with : /sbin/init.d/sendmail stop ; /sbin/init.d/sendmail start

Test by:

# telnet localhost 25

mail from:
rcpt to:
rcpt to:
data
Blah blah blan...

.
quit

This should deliver to your users joe and john on your hpux box, they can then access it with pop or pine.
nothing wrong with me that a few lines of code cannot fix!
Hermann Merz_1
Advisor

Re: sendmail - two domains?

Hello Fred,

you have to tell sendmail which domains are Locally. On HP-UX 10.20 with "normal sendmail" you this in the file
/etc/mail/sendmail.cw

Example:
server1.domain1.com
domain1.com
domain2.com
domain1.us
domain2.us
server1.a-new-domain.com


With this entries in the file you tell sendmail to handle all mails (which were handled by this sendmail) as local domains.
He will cut the ending string (after the @) and go on with the String at the beginning before the @).

In DNS you have to tell the Others Servers that mails to your Domain will be Transfered to your machine

domain1.com. IN MX 10 server1.domain1.com.
domain2.com. IN MX 10 server1.domain1.com.

The Sender-Address should be set by the Mail-Client. Here there can be some Probelems if your Server is Configured as "no Relaying host". Then you need a special Config to tell sendmail which domains are allowed to Relay. But?i am not sure, if you?ve configured your domains in sendmail.cw this Problems should not exist (hopefully).


best regards
Hermann

PS:
Don?f forget to restart sendmail after you?ve done the changes !



Update the world
Fred Martin_1
Valued Contributor

Re: sendmail - two domains?

Ok I almost have this solved - the DNS records now point MX records domain1.com and domain2.com, to the same sendmail server. In sendmail.cw I added the second domain such that it accepts mail for both just fine.

sendmail.cf was not changed.

Now to the clients - people POPing in with Eudora are OK as I just changed the domain used for reply, in Eudora's config (it's obvious in an expanded email header that the domain has been modified but I don't care about that).

Unix users use Pine however, and any attempt I've made to change the user-domain setting in Pine has a strange effect. ALL unqualified addresses appear to be from (or to) the one domain the sender is set up for.

So john@domain1.com mails to joe (unqualified)...in sendmail terms joe is a local user too but technically he's on domain2.com ... the mail is delivered fine, but Pine shows joe to be on domain1.com.

This is because the sender's Pine config seems to handle only one local domain if you see what I mean.

Although sendmail delivery is all good, it gets confusing for Pine users, i.e. what domain am I on really? And domain2 users that receive mail from Pine users on domain1 see themselves as being on domain1 in the header of the message.

Anyway, if someone with good Pine config skills could reply I'd appreciate it.

Fred
fmartin@applicatorssales.com
Kofi ARTHIABAH
Honored Contributor

Re: sendmail - two domains?

Fred:

Why would you want to be able to send a message to joe (unqualified?) I think that in most cases, if you are sending mail to a user joe in another domain (even with eudora) you would have to specify the domain name of the user. Unless you have an alias/address book entry for the user.

In otherwords, if you really need to have users of domain1.com be able to send mail to joe in domain2.com without having to qualify it, you would have to go to pine and create address entries for joe -> joe@domain2.com. You will agree with me that this can be very administratively intensive.

good luck
nothing wrong with me that a few lines of code cannot fix!
Fred Martin_1
Valued Contributor

Re: sendmail - two domains?

Kofi,

All the users are set up on the same unix box, so sendmail considers them all local. The users on domain2.com work for another company but they are a subsidiary of the parent company and sit in the same open office space.

We're trying to, for the "outside world" make the two companies appear more seperate and defined - with two web sites, two email domains.

But in the end, we're on the same network, same mail server. So I'm trying to take advantage of that, in that internally we're all local users.

Seems odd to have to qualify an email to a guy sitting at the desk next to me.

Fred

fmartin@applicatorssales.com
Kofi ARTHIABAH
Honored Contributor

Re: sendmail - two domains?

You are right that it does look strange that you have to qualify a user in the next cubicle... however, remember that as far as pine (or eudora or any other mail agent) is concerned, physical proximity does not mean short-cuts can work :)

I am not sure if there are any email agents out there that will allow you to specify joe and know that joe is in the other domain.... Anyone?

PS. Like I mentioned in my earlier posting, you can customise the users ~/.addressbook to create aliases for the users in the two different domains.
nothing wrong with me that a few lines of code cannot fix!
Fred Martin_1
Valued Contributor

Re: sendmail - two domains?

Eudora works quite well in this setup. The server to POP in to, the domain to add to unqualified addresses, and the reply-to address including domain, are all seperate configuration items.

The interesting item is the domain to add to unqualified addresses. Even though I need to set it to one of the two, the local sendmail server delivers both domain's mail and as such, they're both "local".

But the "From" address is configured seperately and therefore stays correctly set to the sender's domain.

Pine, on the other hand, seems to have one configuration item for both the domain to add to unqualified addresses, and the reply-to domain of the sender.

So if john@domain1 sends Pine mail to jack@domain2 (using jack, unqualified) the header of the mail reads:

From: john@domain1
To: jack@domain1

It gets delivered but is not the correct domain.

And life used to be so simple :)
fmartin@applicatorssales.com
Fred Martin_1
Valued Contributor

Re: sendmail - two domains?

I may have found a solution to this - but thought I'd post it here for anyone following this thread in the future.

Pine has a configuration option called "Roles" that let a single user appear to be replying from more than one domain, depending on the role the user is playing - i.e. the controller of the company could also be the help desk, and his reply-to address would be appropriate for the role.

I am investigating this now but if you already know how to use Pine "roles" then jump in.
fmartin@applicatorssales.com
Fred Martin_1
Valued Contributor

Re: sendmail - two domains?

Forget the 'roles' idea for Pine - roles are for replying to email, not originating a new message. So this is still an open issue.

Pine assumes that any unqualified 'to' address should be 'to' the domain listed in it's config file. So two domains served by the same sendmail server works but the wrong domain is sometimes shown in the header of outgoing messages.
fmartin@applicatorssales.com
Fred Martin_1
Valued Contributor

Re: sendmail - two domains?

I solved the issue by using sendmail's user database. We use it anyway, to rewrite user's names rather than show their login name on internet email. Example:

fredm:mailname fred.martin
fred.martin:maildrop fredm

So I extended that to include the "mail" domain to which they belong:

fredm:mailname fred.martin@domain1.com
fred.martin:maildrop fredm

Incoming mail is handled by DNS, both domains point to the same server. Outgoing mail is re-written by the user database to show the domain name for the subsidiary company the user works for.

Done!

Thanks for your comments,
Fred
fmartin@applicatorssales.com