1. Please take a little time for this simple survey! Thank you for participating!
    Dismiss Notice

How do I make plesk deliver emails to the MX host for a domain if it is local.

Discussion in 'Plesk for Linux - 8.x and Older' started by Quachee, Aug 28, 2005.

  1. Quachee

    Quachee Guest

    Ok this is my problem. I have a site hosted in Plesk, call it domain.com. However, the MX records for domain.com are NOT set to the plesk server but to other external servers. (Basically there is no need for plesk to handle email for this domain) Now even though email for domain.com is disabled in the control panel and the MX records for domain.com correctly point to the external servers, if I attempt to send email FROM the plesk server to anyone@domain.com, the domain is treated as being local and so is never sent to the correct SMTP server defined by the MX records for the domain. So my question is

    How do I host a site in plesk but prevent the domain name from being treated as a local domain with regard to email delivery?
  2. jamesyeeoc

    jamesyeeoc Guest

    Use SSH to login to the server, at the shell prompt use a linux editor to edit the file:


    and make sure the 'domain.com' is removed from the file. Any domains listed in this file will be treated as 'local' and Qmail will attempt delivery locally.

    You do want the domain to be in the
    file, otherwise it will not even accept any mail for the domain, not even to be stored.

    It may also be a good time to also check to make sure that the external mail server(s) are defined in:


    Each line would be a separate external server, such as:
  3. Quachee

    Quachee Guest

    Excellent, thanks a lot.

    I take it those files are not subject to being re-written by Plesk at any point? I would presume Plesk updates those files when new domains are added. Wouldn't that cause domain.com to re-appear in them?
  4. jamesyeeoc

    jamesyeeoc Guest

    Plesk does update those files, but so far (knock on wood) it has never re-entered any of the domains I have manually removed, unless I happened to reconfigure that domain's mail settings.
  5. Quachee

    Quachee Guest

    Brilliant, that soothes a bad headache i had, thanks. Also you have excited me somewhat with regard to this
    Does this mean I can actually setup email relaying for different domains to specific SMTP servers on the LAN side, even if those servers are on non-standard ports?


    If this is the case, it would completely solve another issue I have regarding backup mail servers.
  6. jamesyeeoc

    jamesyeeoc Guest

    Without knowing all the details of what you are trying to accomplish, all I can say is: in theory this will work. And yes, I do this for my own domain as part of a store and forward (backup) MX mail server setup.
  7. Quachee

    Quachee Guest

    Well, the dynamics of the LAN thing i want to do are rather complex so I won't go into it, i'll experiment.

    But if I understand correctly what you are doing with your own domain.The main thing I can see here is how to make the backup server accept your domain name as a RCPT to: without complaining about relay restrictions or delivering the mail locally. Unless of course, QMail will accept it because it is listed in smtproutes.
  8. jamesyeeoc

    jamesyeeoc Guest

    The backup mail server (Qmail) only has to know about the relay domain by putting that domain name into either rcpthosts (or in my case, morercpthosts). You do NOT have to define the domain in the Plesk control panel on the backup mail server since you are not going to host it on this server.

    I have the domain also listed in 'smtproutes' so it knows where to send the stored/received email for that domain.

    The reason I put the 'backup' domains into 'morercpthosts' is to keep those as a separate list from the main 'hosted' domains on the backup server.

    Since the backup domain is NOT listed in 'virtualhosts', Qmail knows that there are no maildirs/mailboxes on the local server for that domain.
  9. Quachee

    Quachee Guest

    Thanks for your lucid and rapid responses. All my headaches are now history. Much appreciated.
  10. Antal

    Antal Guest

    When i change a certain domain to route in the smtproutes file, will it scan for virusses and spam? I'm using 4PSA cleanserver and anti-spam solution! Maybe these scanners only work if the e-mail is stored locally in the mailbox?
  11. akaplan

    akaplan Guest

    Why wouldn't it work to simply disable mail for "domain" ?
  12. rthrash@

    rthrash@ Guest

    Is there a script we could create to periodically rebuid these files. I wind up with a boatload of entries with many duplicates in rcpthosts for example.

    Also, for some reason my MX records defined for a domain are not showing up when I dig the domain, despite them being entered into the Plesk control panel.
  13. btking

    btking Guest

    FWIW, that is exactly what I did without any problems (3 months so far). Never changed anything in the qmail config files, just disabled mail for the domain through the plesk interface...