I have a few hosting clients that handle their own email and I route their MX record via my external DNS service. All works fine.
The issue is when any other account I’m hosting, including me tries to send them an email, my server doesn’t know to look outside itself for their mail record and bounces the mail. I’ve tried adding a mail record pointing to their mail server IP, but no go.
So the question is how can I set the account up so that mail sent from my server knows to use the recipients external server?
Turn off mail for that domain.
Sounds too simple to be true, eh? But, it is. Just look in the Edit Virtual Server page, and open out the "Enabled features" section. Uncheck the box beside "Mail for domain enabled?"
lol… OK, works.
I initially tried setting up the virtual server without the email enabled, but that produced this bounce back error: "Diagnostic-Code: X-Postfix; mail for domain.net loops back to myself".
Ultimately what I have done is enable the mail feature, then edited the mail record to point to the external IP and then disable the mail feature and it works.
"Diagnostic-Code: X-Postfix; mail for domain.net loops back to myself".
This is usually indicative of one of two things:
You didn’t have an MX record pointing somewhere else, or it pointed to yourself (if you don’t have an MX record, SMTP falls back to the domain itself–so, if I didn’t have an MX record, mail to me would deliver to “virtualmin.com”, which in my case would be right…but in the case of a different mail server, it’s obviously wrong).
Or, you had additional configuration in postfix that made Postfix think it was the mail server for this mail–but it had no way to deliver it.
Just for future reference. It sounds like you’ve gotten it straightened out.
You are right…“You didn’t have an MX record pointing somewhere else”
I had added the mail.domain.net record, but wasn’t sure where to add the MX record itself. When I temporarily enabled the email feature, it added everything for me. I then just edited the IP address and turned the mail feature back off.
As I worked out a couple other bugs, I see that this is quite easy to add the needed records. Thanks for the quick response.