Wednesday, January 13, 2010

How to setup a server to handle mails from site which is hosted in another server?

For instance:
serverA -- the server that holds the website
serverB -- the server that holds the mail

In order to be able to receive emails on serverB the domain does not need to be registered there.

You can register a subdomain mail.domain-name.com in serverA to point to serverB and then create an MX record in serverB to point to mail.domain-name.com.

The MX record, short for mail exchange record, is an entry in a domain name database that identifies the mail server that is responsible for handling e-mail for that domain name.

After setting up, all mails sent to @domain-name.com will be handled by the mail.domain-name.com domain which will point to serverB.


Configuration for serverA:

1) Login to the server WHM as the root user.

2) Go to DNS Functions and Edit DNS Zone
Edit DNS Zone

3) Select the domain you want to edit, or type it in, and click on Edit.

4) You should see the following, or something very close to it:

Edit DNS Zone MX

5) Now the MX has a priority of 0 meaning its the only MX entry used for the domain. Replace the domainame.com. with mail.domainame.com.

6) Now change mail from CNAME to A record and take out the domain, and replace it with the IP address.

WHM edit dns mx

7) Save the changes. Bind will reload, if it shows any errors then you did something wrong, make sure the MX entry has a . after it!

8) Login to your server by shell as the root user. Edit the /etc/localdomains file
pico /etc/localdomains then ctrl+w to and type in the domain you modified.
Delete the entry for the domain.
Save the changes to the file, ctrl+x then Y

9) Edit the /etc/remotedomains file - this tells Exim to not handle mail for this domain.
pico /etc/remotedomains
Add the domain name to this file.
Save the changes.

10) Your now done! Make sure you dns is updated, in shell run:
host -t mx domainname.com

You should see mail.domainname.com



Configuration for serverB:

  1. Login to the server WHM as the root user.
  2. Create the domain.com (this will not replace your existing domain.com because this domain name is not pointed or registered to this server)
  3. Go to DNS Functions and Edit MX Entry
  4. Select the domain you want to edit, and click Edit
  5. Replace the domainame.com. with mail.domainame.com and make sure it is priority 0.
  6. Click Save.
  7. Done! You may now try some test mails.

http://www.webhostgear.com/272.html

No comments:

Post a Comment