Solved

Sendmail: Multiple Virtual Domains

Posted on 2004-10-06
9
2,230 Views
Last Modified: 2013-12-17
Hi,

I successfully use sendmail 8.13 for a domain (mydomain.de) as a mail-relay to MS Exchange Servers. I want to do the same thing for a second domain (mydomain.com) so you can send mails to user.name@mydomain.de and also to user.name@mydomain.com and they will both reach the same user.name@mydomain.de mail account on the MS Exchange server.

I followed the instructions for setting up virtual domains using the virtusertable and every else needed. When trying to send a message from the internet to a mydomain.com address I get the following sendmail log:

Oct 6 13:41:17 mailgate sendmail[26540]: i96BfHgl026540: <-- RCPT TO:<test.test@mydomain.com>
Oct 6 13:41:17 mailgate sendmail[26540]: i96BfHgl026540: Milter: rcpts: <test.test@mydomain.com>
Oct 6 13:41:17 mailgate sendmail[26540]: i96BfHgl026540: --- 250 2.1.5 <test.test@mydomain.com>... Recipient ok
Oct 6 13:41:18 mailgate mimedefang.pl[24309]: MDLOG,i96BfHgl026540,mail_in,,,<sender@externaltestdomain.com>,<test.test@mydomain.com>,mail test
Oct 6 13:41:18 mailgate sendmail[26544]: i96BfHgl026540: to=<test.test@mydomain.com>, delay=00:00:01, xdelay=00:00:00, mailer=esmtp, pri=122162, relay=mydomain.com., dsn=5.3.5, stat=Local configuration error

Mimedefang shouldn't be the problem. DNS shouldn't be, too. Sendmail first says "Recipient ok" but lateron gives the error "stat=Local configuration error"???

FILE virtusertable
...
@mydomain.com %1@mydomain.de
...

in sendmail.cf I have the FEATURE virtusertable (per hash) enabled

FILE relay-domains
mydomain.de
mydomain.com

To restart I use
makemap hash virtusertable.db < virtusertable
make -C /etc/mail

Then I restart sendmail and mimedefang

Any ideas?
Help is truly appreciated,
Kurt
0
Comment
Question by:beatboxx
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 3
  • 2
9 Comments
 
LVL 40

Expert Comment

by:jlevie
ID: 12240685
With virtual domains involved you need a different approach than what you were using. The file contents should be:

local-host-names:

mailgate.mydomain.de
mydomain.de
mailgate.mydomain.com
mydomain.com

virtusertable:

@mydomain.          %1@exchg.mydomain.de
@mydomain.com   %1@exchg.mydomain.de

relay-domains and mailertable need to be empty files. And you'll have to tell your exchange server to list for mail addressed to user@exchg.mydomain.de in addition to its default of user@mydomain.de.  And, obviously, the Sendmail server has to be able to resolve the hostname (exchg.mydomain.de) via DNS or the local hosts file.
0
 

Author Comment

by:beatboxx
ID: 12246337
Hi,

is it really necessary to change settings on the exchange server? Isn't there a simple way to have sendmail send all the mails going to

user.name@mydomain.de and
user.name@mydomain.com

to the same e-mail address on the exchange server? The exchange server is not under my supervision and I'm looking for a simple way: sendmail should provide this virtual .com-domain and the exchange server doesn't have to know this domain.

Sorry, but I'm not a pro in this field...still any further advice is appreciated.
Kurt
0
 

Author Comment

by:beatboxx
ID: 12246434
Me again,

I just wanted to provide you with the full error logs:
Oct  7 09:48:06 mailgate sendmail[15952]: i977m490015941: SYSERR(root): MX list for mydomain.com. points back to mailgate.mydomain.de
Oct  7 09:48:06 mailgate sendmail[15952]: i977m490015941: to=<user.name@mydomain.com>, delay=00:00:01, xdelay=00:00:00, mailer=esmtp, pri=125634, relay=mydomain.com., dsn=5.3.5, stat=Local configuration error
Oct  7 09:48:06 mailgate sendmail[15952]: i977m490015941: alias postmaster => postmaster@mydomain.de
Oct  7 09:48:06 mailgate sendmail[15952]: i977m490015941: i977m690015952: DSN: Local configuration error

How can I make sendmail switch the TO address from any.name@mydomain.com to any.name@mydomain.de???

Thx a lot,
Kurt
0
Ransomware-A Revenue Bonanza for Service Providers

Ransomware – malware that gets on your customers’ computers, encrypts their data, and extorts a hefty ransom for the decryption keys – is a surging new threat.  The purpose of this eBook is to educate the reader about ransomware attacks.

 
LVL 40

Expert Comment

by:jlevie
ID: 12251387
> is it really necessary to change settings on the exchange server?

In this case, yes. Your server isn't relaying both of the domains to the exchange server. One domain is virtual and it doesn't exist on the exchange server. So you map addresses in that virtual domain to addresses in the real domain that the exchange server knows about with virtusertable. Once you have to do that with the virtual domain you need to do likewise for the real domain.

0
 
LVL 7

Expert Comment

by:HalldorG
ID: 12251429
The trick that can also be used is a mailertable entry

say that the exchange is accepting mydomain.de

then just add

in
access
mydomain.de RELAY

and in local-host-names you have

mydomain.com


In virtusertable you have

@mydomain.com   %1@mydomain.de

Last you have
mailertable
mydomain.de      esmtp[ipaddress of exchange]







0
 

Author Comment

by:beatboxx
ID: 12296456
Hi,

thx for the tip! But it's still not working...

My access and virtusertable files are as you recommended.

In local-host-names I have
mailgate.mydomain.de
mydomain.de
mailgate.mydomain.com
mydomain.com

Plus I have the mailertable empty since the relaying of mails user.name@mydomain.de to the Exchange Server works (I guess that's because of the "MAIL_HUB" entry in sendmail.mc)

It seems as if sendmail would not change user.name@mydomain.com to user.name@mydomani.de (settings in virtusertable). Shouldn't sendmail first make this recipient changes and then try to send it to the Exchange Server?

Kurt
0
 
LVL 7

Accepted Solution

by:
HalldorG earned 125 total points
ID: 12302623
You should not use the MAIL_HUB entry this is because you are sending all mail to the exchange now not just mail that should be leaving for there.

And as told you should not have mydomain.de in the local-host-names only in access as relay
because the hosts in local-host-names are the one that have local delivery on the sendmail host (linux mailboxes)

The trix is to have mydomain.com in local-host-names so that virtusertable is used rewrite the mailaddresses to
user@mydomain.de and then they are forwarded according to the mailertable entry to the exchange server.

Rememberer to run make after changeing the access, mailertable or virtusertable.
Remember to restart sendmail after changing local-host-names.

You can test what happens with

/usr/lib/sendmail -bv postmaster@mydomain.com and see to where it is sent


0
 
LVL 40

Expert Comment

by:jlevie
ID: 12303819
You can't use:

@mydomain.com   %1@mydomain.de

in virtusertable if local-host-names includes "mydomain.de". That's a circular definition as the local-host-names file tells Sendmail that it is the mail server for the domain and the virtusertable tells Sendmail to send mail for mydomain.com to itself. In this case you must use a virtusertable defintion like I've described above and configure the exchange server to listen for mail addressed to the FQDN in addition to mail addressed to the domain.
0
 

Author Comment

by:beatboxx
ID: 12346215
Thx HalldorG!

sorry jlevie I wanted to split the points but didn't know how and since HalldorG provided the real answer and your comment was more like "helping myself to understand why"....I gave the points to HalldorG

Thx a lot to the both of you guys,
Kurt
0

Featured Post

Simplifying Server Workload Migrations

This use case outlines the migration challenges that organizations face and how the Acronis AnyData Engine supports physical-to-physical (P2P), physical-to-virtual (P2V), virtual to physical (V2P), and cross-virtual (V2V) migration scenarios to address these challenges.

Question has a verified solution.

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

Email signatures have numerous marketing benefits. Here are 8 top reasons to turn your email signature into a marketing channel.
Phishing attempts can come in all forms, shapes and sizes. No matter how familiar you think you are with them, always remember to take extra precaution when opening an email with attachments or links.
In this video we show how to create an Accepted Domain in Exchange 2013. We show this process by using the Exchange Admin Center. Log into Exchange Admin Center.: First we need to log into the Exchange Admin Center. Navigate to the Mail Flow >> Ac…
Nobody understands Phishing better than an anti-spam company. That’s why we are providing Phishing Awareness Training to our customers. According to a report by Verizon, only 3% of targeted users report malicious emails to management. With compan…

726 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