I have an odd request I use a form on my website is there a way to setup mail so that it sends both locally and non locally where DNS records don’t bark at you for doing so.
I have a constant error message about this configuration but the only reason my local mail is kept open is because it roundcube works with this form locally but I can’t get the rest of my mail.
What is the best method to remedy this as my ISP started blocking port 25 for my mail server.
I have no idea what you’re asking. What specific error are you getting and what exactly are you doing when you get the error? I generally need to see the relevant log entries. I’m not sure which log that would be in this case…probably the mail log or the journal for the postfix unit. But, you’ve mentioned DNS records, and I can’t figure out what DNS records could have to do with sending mail locally vs. non-local.
If your ISP blocks port 25, you’ll need to use a relay service like Amazon SES or Sendgrid or Mailjet or Mailgun or whatever. Many options, some have a free tier, most are pretty cheap unless you’re sending a gazillion mails.
“Errors were found in this domain’s DNS records: this domain has email enabled, but none of the MX records … point to it. Either the MX records should be corrected, or the email feature disabled if mail is hosted externally.”
If you want mail delivered to the server itself, you need to send mail to the server itself. You’ve configured your MX records for this domain to point to another server, and Postfix is doing what it’s supposed to do (sending it to the server you have told it, and the rest of the world, to send mail to).
Don’t do that. It doesn’t make sense.
Send to a user on the server itself. If you’re using user@domain.tld format usernames, this can be tricky, since you can’t send to joe@virtualmin.com@srv1.virtualmin.com (if my system hostname was srv1.virtualmin.com), I don’t think.
Since this server can’t possibly be a useful general purpose mail server, and you own it, just send those local emails to root@hostname.tld (not a domain hosted in Virtualmin…the actual hostname of the system…this is the one time I will ever tell anyone to use the system hostname for anything, because you’re doing something weird, and so the solution is weird), or some other local user (e.g. if you have a sudo-capable admin account that you used to login via ssh, that would also work, as long as it’s not a Virtualmin user). This is yet another one of those cases where you need to make sure you didn’t name your system the same as a domain hosted in Virtualmin.
If you need mail to go to more than one user, and managing those users outside of Virtualmin is difficult or confusing, you could also create a domain or an Alias with own Email for local mail and point the MX records to the server itself. But, I don’t think I’d want to do that (I don’t think I’d want to do what you’re doing, either…I’d setup a mail relaying service like Amazon SES or Mailgun or whatever and actually send that mail to my normal mail box).
Virtualmin is trying really hard to make sure things work as expected, and having MX records pointing somewhere else definitely means mail won’t work as expected.
BTW-for anyone reading this, OP privately sent me the actual error, and it is when doing a config check after enabling mail for a domain, and it is “Errors were found in this domain’s DNS records: this domain has email enabled, but none of the MX records … point to it. Either the MX records should be corrected, or the email feature disabled if mail is hosted externally.”