hosting domain with external mail server

Servia

Active Member
Jan 20, 2004
36
0
156
Finland
I had a situation when the customer wanted to keep the domain in their control, and handle mails and dns.
This situation was, at the end, really simple, because all I had to do was to:
1. create account,
2. remove dns zones,
3. remove the domain from localdomains,
4. add the domain to remotedomains.
(5) Also the customer had to change their 'A'-entry to point to my server.

I was a bit confused about this earlier, but I have noticed that it's working. I'm happy about this as we have some customers who have hundreds of email account. And we prefer not to take that big amounts of email accounts, as we've had some problems with emails and cpanel (those problems are though fixed now *fingers crossed*).
 

naox

Well-Known Member
Mar 23, 2004
70
0
156
drmuey said:
Howdy,

We have a domain that we host the website for on Cpanel.

They have their own mail server at a different IP.

I've changed their MX record and if you do a host, dig, or nslookup you get the proper info back.

I also put an entry in /etc/hosts for it.

The problem is that if another domain on that same cpanel server sends mail to the domain with it's own mail server it gets delivered locally, bypassing /etc/hosts and dns!

Therefore the domain with their own mail server do not receive mail from other domains hosted on the same cpanel server since it gets deleiverd locally and not to their mail server.

Any ideas how to get exim to use /etc/hosts or dns?

Or other wise have it not delivered locally but to their mail server?

Thanks

Dan

cPanel.net Support Ticket Number:
sorry for not reading rest of the post here (probably this answer is already there)... Delete domain from /etc/localdomains and it will fix everything. Use http://www.dnsstuff.com/ to chek mail delivry
 

haze

Well-Known Member
Dec 21, 2001
1,540
3
318
naox said:
sorry for not reading rest of the post here (probably this answer is already there)... Delete domain from /etc/localdomains and it will fix everything. Use http://www.dnsstuff.com/ to chek mail delivry
removing the domain from localdomains is only half the battle. If its not present in /etc/remotedomains then the next upcp or mailperm run it will get re-added to localdomains.
 

haze

Well-Known Member
Dec 21, 2001
1,540
3
318
budway said:
Instented easier to user another server for e-mail server ?
I'm not sure what your getting at with the above. The point of the thread is that the client wishes to use his or her own mail server for processing and receiving mail. cPanel is quite capable of handleing mail and there is no reason to avoid that aspect. The point here is that if you have a client with a remote mail server ( their own mail server ) then you would need to make that known to the software via the methods provided above. I hope that clears up your question, and I hope i got it right :)
 

verdon

Well-Known Member
Nov 1, 2003
945
16
168
Northern Ontario, Canada
cPanel Access Level
Root Administrator
Resurecting again

pguy said:
I'll tell you what you need to do in a Step by Step way -

1) Use WHM to edit DNS and change the MX entries.
2) pico /etc/localdomains & remove the domain name
3) pico /etc/remotedomains & check if the domain you edited is there. If not, add it.
Hi :)

I've been kind of stumbling my way through this and ran into a little confusion. I have something set-up that seems to be working, but I'm not sure it is good...

I first just tried to edit my DNS and change the MX entry from the standard put in by WHM - mydomain.com. IN MX 0 mydomain.com. - to one that pointed to the IP of the remote mail server. dnsreport.com didn't like this. Apparently I'm not supposed to use an IP there and am supposed to use a name. On the advice of a friend more knowledgeable than I, I pointed my MX to 'mail.mydomain.com.' instead of 'mydomain.com.' and then changed the CNAME for 'mail' in my zone file to an A pointing to the remote IP, and this seemed to work. I then removed the domain from localdomains and added it to remotedomains.

Does anyone see a problem with this approach? It does seem to be working.

mydomain.com.db BEFORE
Code:
; Modified by Web Host Manager
; Zone File for mydomain.com
$TTL 14400
@	14440	IN	SOA	ns1.nameserver.com.	user.mydomain.com.	(
					2005041506
					7200
					7200
					2419200
					86400
					)

mydomain.com. IN NS ns1.nameserver.com.
mydomain.com. IN NS ns2.nameserver.com.

mydomain.com. IN A  xx.xx.xxx.xx   


localhost.mydomain.com. IN A 127.0.0.1

mydomain.com. IN MX 0 mydomain.com.
mydomain.com. IN MX 50 backupmx.nameserver.com.

mail IN CNAME mydomain.com.
www IN CNAME mydomain.com.
ftp IN CNAME mydomain.com.
mydomain.com.db AFTER
Code:
; Modified by Web Host Manager
; Zone File for mydomain.com
$TTL 14400
@	14440	IN	SOA	ns1.nameserver.com.	user.mydomain.com.	(
					2005041506
					7200
					7200
					2419200
					86400
					)

mydomain.com. IN NS ns1.nameserver.com.
mydomain.com. IN NS ns2.nameserver.com.

mydomain.com. IN A  xx.xx.xxx.xx   


localhost.mydomain.com. IN A 127.0.0.1

mydomain.com. IN MX 0 mail.mydomain.com.
mydomain.com. IN MX 50 backupmx.nameserver.com.

mail IN A xxx.xx.xxx.xx
www IN CNAME mydomain.com.
ftp IN CNAME mydomain.com.
TIA for any insight :)

best regards,
verdon
 

KMK Enterprises

Well-Known Member
Feb 7, 2005
52
0
156
Okay, I just set up a similar situation, where the client wanted to receive email on their server and host their Web site on ours. NetSol is handling the DNS in conjunction with their registration. I followed the directions posted here by Servia,

1. create account,
2. remove dns zones,
3. remove the domain from localdomains,
4. add the domain to remotedomains.
5. change their 'A'-entries to point to an IP on our server.
and ALMOST everything is working just fine. The MX is still pointing at their servers and an http call to the domain with www resolves to our server as does an ftp call, but just the domain name without the www or ftp is still pointing to the wrong IP. I changed the A records for @(none).domainname.com and *.domainname.com at NetSol same as I did for www.domainname.com. I checked the httpd.conf file to be sure both aliases were listed - they are.

When I run host for all the variables (i.e. www, ftp, mail and nothing) from SSH, it returns the right IPs. When I do a DNS lookup at dnsstuff.com it returns the right IPs.

Now I'm stumped. Any suggestions would be greatly appreciated.
 

chirpy

Well-Known Member
Verifed Vendor
Jun 15, 2002
13,437
33
473
Go on, have a guess
Not sure I understand which A records that you have changed, the only A record that should not be pointing to your web server is the new one you create for the MX entry that points to the mail server, not one that you already use. It would help if you posted the zone file.
 

KMK Enterprises

Well-Known Member
Feb 7, 2005
52
0
156
Thanks for replying, Chirpy. Actually, I didn't create a new MX record - I left those as they were because the client wished to have them continue to point at their server. They use NetSol to manage their DNS - we're not handling that on our server. The problem seems to have been a propagation issue, as it's all working fine now. For some reason it just took quite a bit longer for the domain to resolve without the www.

I think I'm spoiled - it's been ages since I've used anything but the cPanel interface for DNS - So, for the benefit of those who may need to use NetSol's DNS manager, they separate DNS management into three different control panels: IP Address/A Records, Mail Servers/MS Records, and Host Aliases/CNAME.

A records for this domain appear as:
www.theirdomain.com xx.xxx.xxx.xxx (IP on our server)
@ (None).theirdomain.com xx.xxx.xxx.xxx (IP on our server)
* (All Others).theirdomain.com xx.xxx.xxx.xxx (IP on our server)
mail.theirdomain.com xx.xxx.xxx.xxx (IP on their server) - did not edit

MX records are listed in rank order (did not edit - as client set it up years ago):
mail.theirdomain.com (20) xx.xxx.xxx.xxx (IP on their server)
NS3.anotherserver.com (10) xx.xxx.xxx.xxx (secondary MX records - 3rd IP on 3rd server)

CNAME: (did not edit)
none

Thanks again for replying, Chirpy.

KMK
 

kingx

Member
Jun 1, 2003
20
0
151
Still having problems with this

i have added the domain to remotedomain, but still get an error in exim saying that the remote host address is the local host
 

chirpy

Well-Known Member
Verifed Vendor
Jun 15, 2002
13,437
33
473
Go on, have a guess
Did you also remove the domain from /etc/localdomains and made sure that the MX record for the domain on the server resolves correctly (you may have to wait for propagation depnding on how you have your DNS setup).
 

sebby

Well-Known Member
Jun 15, 2004
70
0
156
Canada
cPanel Access Level
Root Administrator
verdon said:
On the advice of a friend more knowledgeable than I, I pointed my MX to 'mail.mydomain.com.' instead of 'mydomain.com.' and then changed the CNAME for 'mail' in my zone file to an A pointing to the remote IP, and this seemed to work. I then removed the domain from localdomains and added it to remotedomains.
Hello all !

I followed Verdon's Instruction above. It seems to be working so far.

However, how can I prevent the domain to be added automatically to the etc/localdomains whenever I restart the BIND Services (DNS Server) in WHM ?

Cheers !

Sebby
 

noimad1

Well-Known Member
Mar 27, 2003
626
0
166
hmmmm...i seem to be having this problem as well.

I have confirmed that the user is not listed in the /etc/localdomains /etc/userdomains and is listed in the /etc/remotedomains file, and their mx record is resolving correctly, but I am still getting the:

remote host address is the local host

When sending mail from the same server?

Is there something else that I may be missing?
 

EricP

Registered
May 21, 2008
1
0
51
Deleting DNS Zone did it for me

Wow...it's now nearly 5 years since the last post on this...

I too need to delete the DNS zone file before mail to the same domain started to work as Servia stated:

1. create account,
2. remove dns zones,
3. remove the domain from localdomains,
4. add the domain to remotedomains.
(5) Also the customer had to change their 'A'-entry to point to my server.

I usually use Google Apps Email to set up a domain's email (MUCH MUCH easier than managing email via CPanel).