• 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

Using external email

AndorA

Basic Pleskian
One of the most annoying things about Plesk is its insistence on creating mail domains for domains that don't include mail. If you want to use Plesk to manage all your domains, including those that use an external mail server, you will find yourself in a world of trouble. While Plesk 11.5 adds some functions to use external mail servers for domains like gmail.com, if you also run your own mail server for some domains Plesk still goes out of its way to make your life miserable. Here the best practises I came up with, for whomever it may help. If you have any better solutions to counter this pesky Plesk bug, do let me know!

Say you have two websites, A and B. A uses the mail server on the Plesk machine, B uses an external one. Now, by default, mails from A to B cannot be delivered. Plesk creates accounts for both domain A and B in your mail server, even if the service plan of B contains no mail related services. So if someone on domain A now tries to send a message to someone on domain B, the mail server tries to deliver it locally. That will always fail, of course, and A receives an error and B receives nothing.

Now, ideally, Plesk would only create a mail account for domains for which mail is actually enabled. That is not how it works, unfortunately. Second best would be that Plesk automatically disables the mail domain after its creation for domains that do not use mail, but even that is too much to ask. Third best option would be if you could go into the mail settings in Plesk and disable the domain manually right after creating the mailless domain. Unfortunately, Plesk does leave out all mail controls for domains without mail, including the control that disables mail. Fourth best option: you could write a script that automatically disables the mail domain after it has been created when a service plan without mail support has been used. Unfortunately, the otherwise excellent CLI tools from Plesk do not have a variable that tells you which service plan was used, hence you have no way of knowing if a domain should include mail or not. So all the someone decent options seem to be impossible.

Oh yeah - one more caveat: when creating a mail domain for domains without mail, Plesk ignores any setting on the mail server and in Plesk itself, and always creates an open relay, leaving your server vulnerable to spammers. That's another reason to disable the mail domain.

Under no circumstances should you go to your mail server software to solve the problem; this will prevent Plesk from later modifying or deleting the domain, leading to inconsistencies and clutter in the Plesk database.

So here is the best I could come up with on what to do after creating a domain that does not include mail:

OPTION 1:

1. After creating the domain, RDP to your server
2. Open a command prompt and go to the Plesk bin directory
3. Run the command to disable mail for the domain you just created: mail --off <domain name>

OPTION 2:

1. Make sure to include one mailbox in your service plan, even for packages that do not include mail. This will ensure the creation of a Mail tab in your subscription settings.
2. After creating the domain, go to the mail tab and disable the mail service.

Do note that the option "Ability to change mail settings" in the settings of your service is not enough to get access to your mail settings, you HAVE to add at least one mailbox in order to make the tab "Mail" appear.

Both hacks allow you to essentially create a domain without mail that doesn't give you trouble. The advantage of option 2 is that you do not need to RDP to your server in order to accomplish that, but the downside is that your client can always turn mail back on and use the one mailbox (plus, it would expose you again to the open relay that Plesk sets at least when using Smartermail with Plesk 11.5).

If anyone has a better idea on how to circumvent Plesk's insistence on creating unwanted domains, please let me know!
 
Last edited:
Back
Top