• Please be aware: Kaspersky Anti-Virus has been deprecated
    With the upgrade to Plesk Obsidian 18.0.64, "Kaspersky Anti-Virus for Servers" will be automatically removed from the servers it is installed on. We recommend that you migrate to Sophos Anti-Virus for Servers.
  • The Horde webmail has been deprecated. Its complete removal is scheduled for April 2025. For details and recommended actions, see the Feature and Deprecation Plan.
  • We’re working on enhancing the Monitoring feature in Plesk, and we could really use your expertise! If you’re open to sharing your experiences with server and website monitoring or providing feedback, we’d love to have a one-hour online meeting with you.

Question How to disable local mail lookup without disabling mail services?

websavers

Regular Pleskian
Hey folks; we want to disable local mail lookup / delivery without disabling mail services.

We use a mail relay and would like _all_ mail to route through that. So instead of Domain A delivering to Domain B directly, it should go to the relay and then back to the server for delivery.

Even if we didn't have the relay, though, we would like Plesk/Postfix to do DNS lookups on ALL mail instead of using the local tables.

Thoughts/input?

Cheers,
Allen / Websavers
 
Any ideas for this topic?
We have the same problem.

Customers should not be able to send messages directly to each other. So outgoing mails should always use the relayhost configured in postfix. The relayhost should redirect them back, but checked the mail for spam before redirecting.

So the internal lookup should only work for incoming mails by other hosts then the local postfix server.
 
Not sure this is what you want.
Edit the postfix config at /etc/postfix/main.cf (I use only postfix, not qmail)

1. Modify value of "relayhost" to relay ALL e-mail to another host
2. If above not help, try to disable below value to skip lookup for local domain (this case you need to add/change MX record to your external host)
#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

don't forget to restart postfix service.
 
Thank you very much for your reply.

The relayhost is already configured to the external SMTP Proxy Server.

Your second hint is 50% correct, the internal mails will be forwarded to the external smtp gateway, but the proxy SMTP tries to redirect the mails back to the postfix server. This results in an 550 relay access denied, because the internal lookup doesn't resolve anymore. So the target is to disable the virtual mailbox domains, mailboxes and maps only for the internal MTA, not any external relay.

Thanks in advance
 
I had exactly the same request, and asked Plesk Support about it. This was their reply:

I talked to colleagues and developers if that possible to route local mail through relayhost: they told that we have no known solution for that. We may give an advice regarding basic Postfix configurations, but doing customizations to change default server behavior is not in our scope. So the best option would be to ask in Postfix community. Alternatively probably posting a question on Stack Overflow community may help - it is monitored by a lot of professionals and Linux experts: Newest 'postfix' Questions

I also asked MailChannels about it (we use them as relay server), and they answered this:

I have been researching a way to relay local email delivery via relay host in Plesk and tried many options as per Plesk forums/KBs, but all are not working fine. All the local emails are delivering via only the plesk_virtual relay. plesk_virtual is the actual relay used in Plesk-postfix server to deliver emails to the mailboxes too. If we modify anything on this plesk_virtual relay, this will lead to email delivery issues. Most of the MTAs are designed to deliver local emails via local relay including postfix, exim, etc. In exim, they do have such options to include/exclude emails via the relay host. So I suggest you wait for an update from Plesk itself.

So I'm stuck with this right now.
 
This is now documented in a support article here. It describes how to configure Plesk to:
  1. Force external lookup for specific manually configured domains.
  2. Disable internal routing entirely and force external lookup for all domains. This is the same configuration described on multiple blogs like this one. Important: if you apply this config, you cannot host mail locally for *any* domain; all domains on the server must be using external email services.
In the comments it makes it clear that what we all want -- local delivery if the mail account exists, otherwise check MX records for delivery route -- is not possible:
Postfix designed in a way that if the domain is located on local server it will always deliver locally and will never check for MX records, means it will never attempt to send externally.
However there is a UserVoice feature request for this here. If you want this, make sure to vote on it (we have!) Sadly it has very few votes while silly things like varnish cache and memcached have hundreds... I say silly because there's already nginx caching and most web apps already have their own static cache output now too.
 
Back
Top