• If you are still using CentOS 7.9, it's time to convert to Alma 8 with the free centos2alma tool by Plesk or Plesk Migrator. Please let us know your experiences or concerns in this thread:
    CentOS2Alma discussion

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

Q

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 [email protected], 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?
 
Use SSH to login to the server, at the shell prompt use a linux editor to edit the file:

/var/qmail/control/virtualdomains

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
/var/qmail/control/rcpthosts
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:

/var/qmail/control/smtproutes

Each line would be a separate external server, such as:
domain.com:xx.yy.zz.nn:25
 
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?
 
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.
 
Brilliant, that soothes a bad headache i had, thanks. Also you have excited me somewhat with regard to this
/var/qmail/control/smtproutes

Each line would be a separate external server, such as:
domain.com:xx.yy.zz.nn:25
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?

example
domain.com:192.168.0.4:8025

If this is the case, it would completely solve another issue I have regarding backup mail servers.
 
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.
 
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.
 
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.
 
Thanks for your lucid and rapid responses. All my headaches are now history. Much appreciated.
 
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?
 
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.
 
Originally posted by akaplan
Why wouldn't it work to simply disable mail for "domain" ?

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...
 
Back
Top