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.

hosting domain with external mail server

Discussion in 'E-mail Discussions' started by drmuey, Jun 10, 2003.

  1. drmuey

    drmuey Member

    Joined:
    Jun 10, 2003
    Messages:
    17
    Likes Received:
    0
    Trophy Points:
    1
    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:
     
  2. dotlizard

    dotlizard Registered

    Joined:
    May 19, 2003
    Messages:
    2
    Likes Received:
    0
    Trophy Points:
    1
    same trouble here

    We are having the same problem here, can't send email to our client, and also, the main account where all the unroutable messages go, will not forward off of the server.

    Client will not consider using these mailservers.

    cPanel.net Support Ticket Number:
     
  3. drmuey

    drmuey Member

    Joined:
    Jun 10, 2003
    Messages:
    17
    Likes Received:
    0
    Trophy Points:
    1
    This is what exim told me:
    check the entry for
    local_domains
    in your exim.conf file

    Mine is in /etc/exim.conf and local_domains actuall uses a text file:
    /etc/localdomains
    You just remove the domain from that file and it *should got to /etc/hosts and then on to dns.

    This is what I'm testing as afix right now:

    if yu can do host -t mx domain.com
    and get the mx domain, say mail.domain.com then
    host mail.domain.com
    and get the proper ip address then removing it form the above file should make it sedn to the remoter mail server instead of locally.
    Key word being should, but since I've done that today, no more messages have been sent locally, IE their inbox file hasn't gotten any bigger which it would before.

    If you try thatand it works let em know!
    Thanks

    Dan Muey

    cPanel.net Support Ticket Number:
     
  4. drmuey

    drmuey Member

    Joined:
    Jun 10, 2003
    Messages:
    17
    Likes Received:
    0
    Trophy Points:
    1
    All indications are that this is working now.
    Basically it would be nice if Cpanel removed it for you when you change a domain's mx record/mx domain ip address to a remote mail server or give them the option to remove it from the local exim system and tell them they may want to do that when they mess with the mx records.

    Hope that helps!

    Dan Muey

    cPanel.net Support Ticket Number:
     
  5. pguy

    pguy Well-Known Member

    Joined:
    Feb 21, 2003
    Messages:
    73
    Likes Received:
    0
    Trophy Points:
    6
    You will need to remove the domain entry from /etc/userdomains and /etc/localdomains . However if you run /scripts/mailperm, it will add the entries back to /etc/localdomains.

    So what you need to do in addition to removing it from /etc/localdomains is to add the domain name in /etc/remotedomains. Once you add it there, the scripts will not make any automatic changes.


    Warm Regards

    cPanel.net Support Ticket Number:
     
  6. drmuey

    drmuey Member

    Joined:
    Jun 10, 2003
    Messages:
    17
    Likes Received:
    0
    Trophy Points:
    1
    Excellent! Thanks a million! That is good to know.
    Are the other two files you mentioned used by Exim like /etc/localdomains is?
    I just don't want to mess up any of their cpanel stuff.

    Thanks again I'm sure many people will find this usefull.

    Dan Muey

    cPanel.net Support Ticket Number:
     
  7. pguy

    pguy Well-Known Member

    Joined:
    Feb 21, 2003
    Messages:
    73
    Likes Received:
    0
    Trophy Points:
    6
    Hello Dan,

    I just did a similar setup for a client and found that Cpanel adds the domain name to /etc/remotedomains automatically. My experience previously was that it never used to.

    I guess they finally updated it to work fine :D

    However since some of you are still facing the issues, I am not really sure if its the case across all the servers.

    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.

    I mentioned in my previous message about /etc/userdomains , you can ignore that. It will get added right back during a cpanel update or by running of other certain scripts.

    Regards,

    cPanel.net Support Ticket Number:
     
  8. drmuey

    drmuey Member

    Joined:
    Jun 10, 2003
    Messages:
    17
    Likes Received:
    0
    Trophy Points:
    1
    Sweet thanks!!
    That should do the trick.

    Dan

    cPanel.net Support Ticket Number:
     
  9. decebal

    decebal Registered

    Joined:
    Mar 19, 2002
    Messages:
    3
    Likes Received:
    0
    Trophy Points:
    1
    excellent

    thanks a million ... this works ... i was wondering what the remotedomains does.

    :)

    decebal

    cPanel.net Support Ticket Number:
     
  10. Drake

    Drake Well-Known Member

    Joined:
    Nov 9, 2001
    Messages:
    83
    Likes Received:
    0
    Trophy Points:
    6
    Location:
    New Jersey
    cPanel Access Level:
    DataCenter Provider
    Why hasn't anyone mentioned changing the MX entry and the 'mail' subdomain in the DNS zone file to point at the external mail server? That way any incoming mail will go directly elsewhere as specified.

    www.DuraServer.net
    Web Hosting ~
    Shared & Dedicated Servers ~
    Networking ~ Linux
     
    #10 Drake, Jun 25, 2003
    Last edited: Jun 25, 2003
  11. pguy

    pguy Well-Known Member

    Joined:
    Feb 21, 2003
    Messages:
    73
    Likes Received:
    0
    Trophy Points:
    6
    The server will first check if the domain exists locally. If that is the case, it will first try to deliver the email locally. This will happen if you have scripts/formmails etc installed on the domain.

    Since they run on the server, they will directly deliver the email to the server first without looking outside.

    cPanel.net Support Ticket Number:
     
  12. spaceman

    spaceman Well-Known Member

    Joined:
    Mar 25, 2002
    Messages:
    481
    Likes Received:
    0
    Trophy Points:
    16
    A small related note that might help others:

    If your name servers are _not_ authoritative for the hosted domain (ie. your client manages their own DNS and mail servers), then consider 'Deleting the DNS zone file' for the domain as well via WHM. The risk of not doing this (and instead pointing MX records to their mail server) is that if your client changes their mail setup (name, ip), mail for them passing through your server (eg. from a web form) will be delivered to the wrong location and it can take a while before anyone notices. We've been caught out by this on a number of occasions.

    Hope that helps someone :)

    cPanel.net Support Ticket Number:
     
  13. pavemen

    pavemen Active Member

    Joined:
    Oct 8, 2003
    Messages:
    27
    Likes Received:
    0
    Trophy Points:
    1
    Sorry to bring this back from the dead, but I found a few new issues that this thread fixed.

    I had a server restored and restored my backups. One of the accounts used everyone.net. It worked perfect prior to the OS restore. It worked after teh account restore.

    Then I installed the MailScanner 1.5 from layer1. Wasnp;t working like I had hoped it would (had it on previous OS image without issue) so I used the uninstall.

    After the uninstall, mail to the domain using everyone.net no longer was delivered as it failed internally. Apparently the mailscanner uninstall reverted all my /etc/*domains files and mail was no longer routed correctly.
     
  14. iamclogger

    iamclogger Registered

    Joined:
    Dec 9, 2004
    Messages:
    1
    Likes Received:
    0
    Trophy Points:
    1
    If the remotehosts and localhosts files are not in the /etc folder what is the format of those files if I need to create them?

    Can someone post an example of their file for me to reference?

    Thanks
     
  15. pavemen

    pavemen Active Member

    Joined:
    Oct 8, 2003
    Messages:
    27
    Likes Received:
    0
    Trophy Points:
    1
    simple plain text with one domain per line:


    domain1.com
    domain2.net
    etc
     
  16. DavidR

    DavidR Well-Known Member

    Joined:
    Feb 25, 2003
    Messages:
    177
    Likes Received:
    0
    Trophy Points:
    16
    I have a question along these lines. In the same situation, with a domain client wanting to use their outside servers for email, they give me an IP to forward MX to. Now, cPanel says you can't forward MX to an IP, only a domain name. So, would it be wise to edit the domain zone for their domain with me so that mail.domain.com goes to the ouside IP, then change MX records to forward to mail.domain.com? This has been confusing to me for some time. Thanks.
     
  17. haze

    haze Well-Known Member

    Joined:
    Dec 21, 2001
    Messages:
    1,550
    Likes Received:
    3
    Trophy Points:
    38
    VIA WHM edit the dns zone so that the mail.domain.com points to the IP And change it from cname to A record. Make sure the MX has the mail.domain.com bit. Then in SSH, ad the domain to the /etc/remotedomains file on a new line then run /scripts/mailperm and your done!
     
  18. DavidR

    DavidR Well-Known Member

    Joined:
    Feb 25, 2003
    Messages:
    177
    Likes Received:
    0
    Trophy Points:
    16
    Just to clarify, we are talking about files named "localdomains" and "remotedomains", not "localhosts" and "remotehosts", correct?

    David
     
  19. haze

    haze Well-Known Member

    Joined:
    Dec 21, 2001
    Messages:
    1,550
    Likes Received:
    3
    Trophy Points:
    38
    That is correct.
     
  20. DavidR

    DavidR Well-Known Member

    Joined:
    Feb 25, 2003
    Messages:
    177
    Likes Received:
    0
    Trophy Points:
    16
    Thanks. This worked perfectly :D
     
Loading...

Share This Page