Stop Receiving Spam with Cpanel Published: Dec 20, 2005
  • Rating


Change the MX record of your website HOWTO is an easy guide for modifying your MX record to direct mail from one mail server to another for Cpanel users.

Changing Your Sites MX Record

Change the MX record of your website HOWTO is an easy guide for modifying your MX record to direct mail from one mail server to another for Cpanel users. The MX record, short for mail exchange record, an MX 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.

Basically you can have one server handle your website and another handle your email, such as Cpanel for the site and a Windows Exchange machine for mail if you want. You can also have multiple MX records so mail can go to more than one server and order them in priority by number, the lowest number will receive mail first but more on that later.

Requirements: Cpanel server with admin access

Cpanel MX Record - How to change your MX record

First off there are a few different ways to change your websites MX record. If you are not a server administrator then you have limits to doing this and may need to contact your system admin to have them set this up for you. As a regular Cpanel user you can only add one mx record and can't set any type of priority on it, secondly you cannot set a MX record as an IP address. You'll need to contact the admin once again. Otherwise go to Cpanel, Mail, MX record and enter the full domain of the server you want mail to go to and it will do the rest.

Advanced MX Changes - CHANGE TO IP ADDRESS

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 with

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

You should see

  • Rating


Related Articles

Comments (3)

  • Gravatar - spam_hater
    spam_hater 17:38, July 19, 2006
    Is it possible to Filter spam at the WHM level. <br />
    <br />
    ie. Apply filters just like in cpanel, but the filter will apply to every account on the server.
  • Gravatar - klp
    klp 20:16, July 25, 2006
    excellent tips with c-panel if I must say. Can we also filter out IP addresses located in the header, if we do know that a large portion of spam is coming from such a location? usually with the IP addresses, (based on my experience) the last to digits are always changing. But if this can still work, wow! that would be like a cherry on top of the cake!
  • Gravatar - Steve
    Steve 16:47, July 26, 2006
    Yes, you need to add the rules manually through shell though. Edit the file /etc/antivirus.exim this is the central filter for the mail server and can protect incoming and outgoing.

Add Your Thoughts is a hosting directory, not a web host.

Copyright © 1998-2017