Postfix, all emails to external for WordPress

Hello,

we use Virtualmin with an Wordpress Installation, but our E-Mails will be managed by an external mail provider for our domain. So when Wordpress send us an email, the email won´t arrive us, because postfix will put the emails within the server instead to send this email out.

Is there an option to prevent this, so that postfix doesn´t use the internal mails?

If you change Virtualmin’s DNS records for the WordPress virtual server to reflect the actual MX for the domain, it might do the trick.

Email generated by WordPress will then reach the real / external mailbox for the domain instead of it getting snagged for delivery to one of the local users / mailboxes for that virtual server in Virtualmin.

@carty_ttv,

You can setup a plugin to make use of SMTP, then configure WordPress to connect to external SMTP server so messages are sent via this server.

Another option is to setup “relayhost” whereby you relay mail via your local Postfix installation to an external server.

It highly depends on how you are doing things, which solution would be most appropriate. Additional steps may be necessary.

As an email specialist, I can assist you in getting things setup to meet your needs if you would be interested.

*** this would be a billable task, but my rates are affordable, and you’re assured a solution before paying. ***

Best Regards,
Peter Knowles | TPN Solutions

Need Professional, Affordable Tech Support? Request Assistance at: https://tpnassist.com

This is a WordPress question, Virtualmin has no part in how WordPress sends mail, if it isn’t sending it via local sendmail command (though if everything will be using an external mail server you could setup relaying in Postfix).

Sorry for the late answer.
Thx for your help.

This isn´t only a Wordpress thing. because if i install Roundcube and write to another user under the same domain, the e-mail will be sendet directly to this postmail without sending over an smtprelay, because postfix will check this: hey i know this domain, this is my domain on my server, i put it directly to the postbox in the right domain. I don´t send it to the internet.

And that ist the problem that i have. I suggest, that all e-mails (include the internals) will be send out to the internet, with programm that uses a sendmail funktion as Roundcube, Squirrelmail or wordpress and something else. So the EMails will go to the mx settings in our domain to an special e-mail server.

This only happens if you’ve enabled mail for the domain in Virtualmin. If you aren’t intending to receive mail for the domain, that isn’t right.

You can configure relaying in Postfix. There is an example of this in the postfix docs: Postfix Small/Home Office Hints and Tips

relayhost is the option you’re looking for, but you probably need to also setup authentication, so it’s more complicated than just setting a relayhost.

1 Like