Sunday, January 23, 2011

Plesk mail delivery issues to domain with disabled mail

OS: CentOS 5.4
CP: Plesk 9.3
MTA: Postfix
Plesk appears to have a bug in it where if you disable a domain mail function Plesk leaves various entries in the postfix mailertables.  For example, domain has mail disabled on it, but, Plesk leaves entries in the following mail tables used by postfix:
This is a big problem when the domain has mail hosted else where and they want to send emails to the domain via web forms on the site.  This is a very common requirement especially when the sites has contact, enquiry and sales forms sending emails to the domain.
There shouldn’t be any local entries in the mailer tables so that the mail server looks up the MX record of the domain and sends the email to the remote mail server.
This bug has been prsent for a few months now and even Parallels paid support hasn’t been able to grasp the problem:
Not only that, what is the deal with the other random entries for the domain such as: root, postmaster, drweb and anonymous.  Some are part of recommended email addresses RFC (rfc2142), however, it still breaks what we need/what to do.
Not sure at the moment if this bug only affects Postfix.  Will be testing qmail shortly.
UPDATE 25/03/2010:
Found a work around for this.
strings virtual.db | grep
Went into the Plesk control panel for the domain and checked the the domains email was disabled under mail preferences… it was.
“Mail to nonexistent user” did not have any options selected which was a bit strange.  Possibly was not selected due to migrating site from Plesk 8.x.
  • Enabled mail for the domain
  • Selected “Forward to address” and then changed it to “Reject mail to nonexistent user”
    (One or the other will probably work)
At this point the virtual.db entries disappeared.  It was still gone once mail for the domain was disabled again.
Then, to get rid of the individual aliases such as: drweb, root, postmaster, anonymous
Add new mail accounts (doesn’t need to be mailbox) for each alias and then delete them again.  This appears to remove the entries from the virtual.db file.  To make removing them all slightly faster you can create one mail account and add the rest as aliases and just delete the mail account.