• 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

Emails from hosted domains not routing to 3rd party servers

Agreed, and I'll give it a go, but it's a work-around for faulty Plesk software, isn't it? A more permanent and expected solution would be a bug-fix.
 
Ok, tried it, but no-go.

Enabling the DNS server gave a list of entries for my site, including an MX record to mail.mysite.com. I removed that record and substituted one pointing to the google servers (ASPMX.L.GOOGLE.COM). I then retried my mail() function, but still received nothing. I tried the mail() function with a non-hosted address, and it worked perfectly.
 
missionaryman, can you post some relevant extras from /usr/local/psa/var/log/maillog? Wouldn't hurt to also post the output of:
grep -v "^$\|^#" /etc/postfix/main.cf | grep plesk
My guess is Plesk is still configuring Postfix to deliver to local domains even tho it shouldn't.
Make sure you're obfuscating domain names, hostnames and such when replying.
 
Hi Burnley,

Here's some of the info you asked for.

a) The following is from maillog having just used the php command mail() to send an email, successfully, to a particular gmail address:

Code:
[root@vps##### ~]# tail /usr/local/psa/var/log/maillog
Oct 14 11:11:03 vps##### postfix/smtpd[4818]: disconnect from unknown[216.177.214.3]
Oct 14 11:14:23 vps##### postfix/anvil[4820]: statistics: max connection rate 1/60s for (smtp:216.177.214.3) at Oct 14 12:11:02
Oct 14 11:14:23 vps##### postfix/anvil[4820]: statistics: max connection count 1 for (smtp:216.177.214.3) at Oct 14 12:11:02
Oct 14 11:14:23 vps##### postfix/anvil[4820]: statistics: max cache size 1 at Oct 14 12:11:02
Oct 14 18:23:03 vps##### postfix/pickup[8450]: 0C6B62741504: uid=10000 from=<#######>
Oct 14 18:23:03 vps##### postfix/cleanup[9093]: 0C6B62741504: message-id=<20131014182303.0C6B62741504@vps#####.ovh.net>
Oct 14 18:23:03 vps##### postfix/qmgr[28448]: 0C6B62741504: from=<#######@vps#####.ovh.net>, size=441, nrcpt=1 (queue active)
Oct 14 18:23:03 vps##### postfix/smtp[9095]: certificate verification failed for gmail-smtp-in.l.google.com[2a00:1450:400c:c05::1b]:25: untrusted issuer /C=US/O=Equifax/OU=Equifax Secure Certificate Authority
Oct 14 18:23:04 vps##### postfix/smtp[9095]: 0C6B62741504: to=<########@gmail.com>, relay=gmail-smtp-in.l.google.com[2a00:1450:400c:c05::1b]:25, delay=1.1, delays=0.06/0.03/0.23/0.74, dsn=2.0.0, status=sent (250 2.0.0 OK 1381774984 cl1si5949632wib.45 - gsmtp)
Oct 14 18:23:04 vps##### postfix/qmgr[28448]: 0C6B62741504: removed

b) Here's another snippit from the maillog, this time having sent an email, unsuccessfully, to an address hosted by Plesk but with MX records pointing to GOOGLEMAIL:

Code:
[root@vps##### ~]# tail /usr/local/psa/var/log/maillog
Oct 14 18:24:38 vps##### postfix/pickup[8450]: DEEEF2741256: uid=10000 from=<#######>
Oct 14 18:24:38 vps##### postfix/cleanup[9093]: DEEEF2741256: message-id=<20131014182438.DEEEF2741256@vps#####.ovh.net>
Oct 14 18:24:38 vps##### postfix/qmgr[28448]: DEEEF2741256: from=<#######@vps#####.ovh.net>, size=449, nrcpt=1 (queue active)
Oct 14 18:24:39 vps##### postfix-local[9199]: postfix-local: from=#######@vps#####.ovh.net, to=adam@######.co.uk, dirname=/var/qmail/mailnames
Oct 14 18:24:39 vps##### postfix-local[9199]: cannot chdir to mailname dir adam: No such file or directory
Oct 14 18:24:39 vps##### postfix-local[9199]: Unknown user: adam@######.co.uk
Oct 14 18:24:39 vps##### postfix/pipe[9198]: DEEEF2741256: to=<adam@######.co.uk>, relay=plesk_virtual, delay=0.16, delays=0.03/0.04/0/0.1, dsn=2.0.0, status=sent (delivered via plesk_virtual service)
Oct 14 18:24:39 vps##### postfix/qmgr[28448]: DEEEF2741256: removed

c) Finally, here's the result of the requested grep -v "^$\|^#" /etc/postfix/main.cf | grep plesk

Code:
[root@vps##### ~]# grep -v "^$\|^#" /etc/postfix/main.cf | grep plesk
alias_maps = hash:/etc/aliases, hash:/var/spool/postfix/plesk/aliases
virtual_mailbox_domains = $virtual_mailbox_maps, hash:/var/spool/postfix/plesk/virtual_domains
virtual_alias_maps = $virtual_maps, hash:/var/spool/postfix/plesk/virtual
virtual_mailbox_maps = , hash:/var/spool/postfix/plesk/vmailbox
transport_maps = , hash:/var/spool/postfix/plesk/transport
smtpd_sender_restrictions = check_sender_access hash:/var/spool/postfix/plesk/blacklists, permit_sasl_authenticated, check_client_access pcre:/var/spool/postfix/plesk/non_auth.re
smtpd_recipient_restrictions = permit_mynetworks, check_client_access pcre:/var/spool/postfix/plesk/no_relay.re, reject_unauth_destination
sender_dependent_default_transport_maps = hash:/var/spool/postfix/plesk/sdd_transport_maps
virtual_transport = plesk_virtual
plesk_virtual_destination_recipient_limit = 1

Can you see anything wrong?
 
misionaryman, I think you'll get rid of the local mail routing issue altogether after removing Plesk specific configuration entries. But before making any change, *PLEASE* bear in mind that:
- there could still be a Plesk misconfiguration at your end which you may be able to solve before continuing
- some or all of my suggestions could be wrong. In fact it's quite possible that I might have misunderstood your environment and use cases completely.
- you should always have recent backup copies before making any changes
- Plesk is almost guaranteed to overwrite main.cf & master.cf during upgrades and/or when applying the micro updates, so always keep backups of your customized files.
This being said, if I was you:
1. in master.cf I would comment out the lines beginning with: plesk_virtual, mailman and plesk_saslauthd
2. in main.cf I would:
- comment out the entries starting with: virtual_mailbox_domains, virtual_alias_maps, virtual_mailbox_maps, transport_maps, sender_dependent_default_transport_maps, virtual_transport, plesk_virtual_destination_recipient_limit
- modify the other configuration parameters as following (don't edit the existing entries, just comment them out):
alias_maps = hash:/etc/aliases
smtpd_sender_restrictions = reject_unknown_sender_domain
smtpd_recipient_restrictions = permit_mynetworks, reject_unauth_destination
3. reload Postfix
In fact, if you're not receiving emails for any of the hosted domains from external servers the smtpd_* entries are useless and you should force Postfix to listen to localhost only.
Anyway, I'd be really like to know, looking at these 3 log entries, where is the email being delivered for non-existent domains :)
Oct 14 18:24:39 vps##### postfix-local[9199]: cannot chdir to mailname dir adam: No such file or directory
Oct 14 18:24:39 vps##### postfix-local[9199]: Unknown user: adam@######.co.uk
Oct 14 18:24:39 vps##### postfix/pipe[9198]: DEEEF2741256: to=<adam@######.co.uk>, relay=plesk_virtual, delay=0.16, delays=0.03/0.04/0/0.1, dsn=2.0.0, status=sent (delivered via plesk_virtual service)
 
Thanks for the detailed reply, however I'm not sure I want to go in this direction. It seems like I'm having to fix Parallels software for them! And I'm paying a monthly fee to use it. Let's see if anyone from the company can shed some light on this problem?
 
The solution might be simpler than what has been suggested here. To send mail generated from abc.com (that is running on your Plesk server) to the mail server (abc.com) that is running on a different mail server, the easiest approach is to keep the "enable mail management functions in panel" checked (somewhat counterintuitive) but then you need to take the extra step of accessing the domain panel as danliker suggested (Domains -> <DOMAIN> -> Mail -> Change Settings ->) but UNCHECK "Activate mail service on domain"

This effectively enables PostFix to rout mail that is destined to "[email protected]" correctly to your external mail server.

Please post your results if this works (or doesn't)!
 
Not sure why but the preceding reply with the solution didn't make it but let's try this again -

In simple terms, you have this issue:

- abc.com is running on your amazing Plesk server that is always clear and easy to manage... and your abc.com customer uses some third party or external mail service
- When messages are generated by scripts etc... running on your abc.com domain, they bounce as Postfix runs a local lookup which will invariably fail as the users don't exist locally
- You need to tell Postfix to stop looking up the email domain/users locally so that a message generated from a contact form at abc.com (whose recipient is [email protected]) goes to abc.com's third party mail service (i.e. Google Apps, MS 365, etc...)

To accomplish what you are looking to do, it is quite simple (but a little counter-intuitive) and doesn't require much knowledge of Plesk.

1. Ensure that "Enable mail management functions in panel" is checked (this is a bit strange but you'll see)
2. Access the domain's control panel (Domains -> <DOMAIN> -> Mail -> Change Settings)
3. UNCHECK "Activate mail service on domain"

This will force PostFix to bypass the local lookup, ensuring that the mail destined for that domain gets routed correctly.

On an additional note, you shouldn't have to make any complex changes as some posters are suggesting - And this approach will enable your customers to use whatever third party mail services they chose without requiring you to monkey around with unsupported file changes.

Please post your results by following these steps!
 
Last edited:
Ok, here goes:

1) "Enable mail management functions in panel" already checked.
2) Not where you said! In my panel (11.5.30) it is <MAIL> then <Change Settings>
3) "Activate mail service on domain" already unchecked.

I tried sending another email using mail(), but nothing was delivered.
 
My apologies - I was using referring to an 11.0.9 install as a guide

Are you able to send using mail() to email addresses on other domains that are not on your Plesk 11.5.30 server?
 
Yes.

mail() successfully sends emails to addresses which are not hosted on Plesk.
mail() fails to send emails to addresses hosted on Plesk but having 3rd party email servers.
 
I don't believe that you should even need to be concerned about the DNS zone being run on the Plesk install since Plesk should enable you to use third party mail servers for a locally hosted domain regardless of whether DNS is run on the Plesk install or whether it is run externally. We run it externally for resiliency and fail-over purposes but perhaps igor can provide some more insight as this issue doesn't seem to be isolated to just one instance.

Is your server a fresh install of Plesk 11.5 or was it an upgrade from a prior version?
 
It's a fresh install on a VPS. I ordered the VPS complete with Plesk Panel, so had no input into the setting up of the server.
 
Thank you for the clarification - Perhaps Igor can confirm if this is a known bug with 11.5

On 11.0.9 the steps provided result in the desired results but 11.5 must have a different implementation.

If you figure this one out, please post your results here -
 
Thanks for the detailed reply, however I'm not sure I want to go in this direction. It seems like I'm having to fix Parallels software for them! And I'm paying a monthly fee to use it. Let's see if anyone from the company can shed some light on this problem?
If I were you I would test those changes and see if they fix the problem without introducing other ones. At least, this way you'll be able to give really useful feedback to Parallels and you can even make a case for changes in the way they configure Postfix. After some years spent in the industry I've learned that the approach "I don't know, I don't care, *they* should fix it, I'm paying for it" doesn't quite work as expected :)
 
Still hoping Igor or someone from Parallels will respond to the investigations that have been taking place regarding this issue before I go diving into the configuration files.

It's not that I'm of the "I don't know, I don't care, *they* should fix it, I'm paying for it" attitude (at least I don't think I am - I hope it hasn't come over that way) but rather "I'm new to Parallels, I have a VPS with a number of commercial sites running on it, and I don't want to screw it all up by altering thngis I know very little about".

Any chance of a nudge in the right direction from someone official? (No offence, burnley!)
 
Still hoping Igor or someone from Parallels will respond to the investigations that have been taking place regarding this issue before I go diving into the configuration files.
from someone official?

Sorry, I lost the essence of this conversation. Could you please formulate a specific question that would like to get an official response?
 
Seriously?! You lost the "essence" of the conversation? Nothing has changed. Here's the original post for you:

Hi,

My Plesk panel (11.5.30) hosts a number of domains that all use Google Apps for Business to host their emails. No emails are hosted on the panel, and the mail server is turned off. So is the DNS server.

Using the mail() php function to send automatic confirmation emails from a website hosted on the panel, they arrive at any address NOT hosted locally, however they fail to arrive at any address whose website is locally hosted.

My initial research suggested that Plesk was routing locally, hence the problem, however the mailserver has been turned off the for domain/webspace.

Anyone have any suggestions as to how to trouble-shoot this issue?

Thanks,

MM
 
Well. What sort of output of following command:

# postmap -s /var/spool/postfix/plesk/virtual_domains |grep <your.domain>

Perhaps there remained record and Postfix believes that it is his domain and then sends all mail to local mailboxes?
 
Back
Top