The Community Forums

Interact with an entire community of cPanel & WHM users!
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

MX/SMTP Forwarding with Backup

Discussion in 'E-mail Discussions' started by DReade83, Oct 20, 2006.

  1. DReade83

    DReade83 Well-Known Member

    Joined:
    Oct 20, 2006
    Messages:
    196
    Likes Received:
    0
    Trophy Points:
    16
    Location:
    Cheshire, UK
    Is it possible to setup cPanel so that any email sent to the domain is forwarded on to a specific IP address (with an Exchange Server on the other end), or if the Exchange Server is down, the email is collected and queued on the cPanel server, while cPanel tries to send the queued mail every X minutes and, as soon as the Exchange Server comes online, the mail is automatically delivered?
     
  2. rikgarner

    rikgarner Well-Known Member

    Joined:
    Mar 31, 2006
    Messages:
    75
    Likes Received:
    1
    Trophy Points:
    8
    Location:
    /dev/null
    Hi,
    Yes, this is perfectly feasible, and we do this with numerous hosted domains, including our own. What you need to do is:

    1. Open up port 25 on your firewall, and port-forward to your internal server via NAT. I strongly recommend you use a firewall which sports "service proxies", we use Watchguard Core series firewalls precisely for this reason.

    2. If your internal exchange server is on a domain identical to your external cpanel domain, then you need to add an a-record to Cpanel DNS which has an identical name to your internal server, for example: mysbsserver01 -> 195.5.5.5.

    3. Set the primary mx record with a low value (5?) to be mysbsserver01.mydomain.com. (Dont forget the trailing . otherwise it wont work!).

    4. SSH onto the server, cd to /etc and vi localdomains. You need to remove the domain you just changed the MX for, and while still in /etc, vi remotedomains and add the domain you just removed from localdomains, otherwise anyone else relaying through your server will get a "mailbox not found" error, or worse, they will build up in a pop-box you are not collecting.

    This will have mail going into your exchange server via SMTP. Now, to set Cpanel up to secondary, you need to:

    5. In /etc vi secondarymx, and add in your domain name. The file may not exist, but thats normal on some servers.

    It *may* be nescessary to tweak your exim.conf to make exim look at the secondaryMX file, to be sure, take a look at exim.conf and make sure it shows the following:

    domainlist local_domains = lsearch;/etc/localdomains

    domainlist relay_domains = lsearch;/etc/localdomains : \
    lsearch;/etc/secondarymx
    hostlist relay_hosts = lsearch;/etc/relayhosts : \
    localhost

    Then all you need to do is head back to DNS config, add a secondary MX with a weighting higher than the first one (10?) which points to the IP Exim is running on.

    Sorted!

    Rich
     
  3. DReade83

    DReade83 Well-Known Member

    Joined:
    Oct 20, 2006
    Messages:
    196
    Likes Received:
    0
    Trophy Points:
    16
    Location:
    Cheshire, UK
    Wow, cheers Rich! I'll give that a try and keep you posted.
     
  4. rikgarner

    rikgarner Well-Known Member

    Joined:
    Mar 31, 2006
    Messages:
    75
    Likes Received:
    1
    Trophy Points:
    8
    Location:
    /dev/null
    No worries ;)

    Just in case your not aware of it, http://www.dnsreport.com is a fantastic way of checking if you got your DNS settings right :cool:

    Rich
     
  5. DReade83

    DReade83 Well-Known Member

    Joined:
    Oct 20, 2006
    Messages:
    196
    Likes Received:
    0
    Trophy Points:
    16
    Location:
    Cheshire, UK
    One thing, how do you tell cPanel how many times to check to see if the remote server is active? Does it ping the server every few seconds or minutes to see if it's online?
     
  6. rikgarner

    rikgarner Well-Known Member

    Joined:
    Mar 31, 2006
    Messages:
    75
    Likes Received:
    1
    Trophy Points:
    8
    Location:
    /dev/null
    AFAIK, Exim will follow its normal message-delivery retry periods, listed in exim.conf.


    Rich
     
  7. DReade83

    DReade83 Well-Known Member

    Joined:
    Oct 20, 2006
    Messages:
    196
    Likes Received:
    0
    Trophy Points:
    16
    Location:
    Cheshire, UK
    Well, it worked. Thanks Rich. You've just saved me £150/annum in SMTP Backup charges with Zen! :D

    Exim appears to try sending at 5 sec, 10 sec, 30 sec, 1 min intervals and so on, which is great.
     
  8. rikgarner

    rikgarner Well-Known Member

    Joined:
    Mar 31, 2006
    Messages:
    75
    Likes Received:
    1
    Trophy Points:
    8
    Location:
    /dev/null
    Oops! We're a Zen partner! ;)

    I can't fault their services, but there is nothing better than being able to do it yourself ;)

    Rich
     
Loading...

Share This Page