Help needed with virtualmin and cloudflare emails

SYSTEM INFORMATION
OS type and version Ubuntu 20.04.5 LTS
Virtualmin version 7.3-1

thank you for all your information and help. I’m having Webmin and Virtualmin(LEMP stack) installed on Ubuntu 20.04. Machine is VM on Hetzner Cloud.

FQDN is configured to use Cloudflare NS and the domain is added on Cloudflare as a site. Cloudflare Cloudflare DNS and SSL are configured as following :
https://i.postimg.cc/kggsdvHt/cf-dns.png
Cloudflare SSL and TLS settings are as follows:
https://i.postimg.cc/RC1L6Y5H/cf-ssl.png

A domain name is added on Virtualmin and configured to use following:
https://i.postimg.cc/0QR7rYVn/virtualmin-vhost.png

DNS for domain is enabled and - Nginx with SSLvhost is working great. Virtualmin DNS options:
https://i.postimg.cc/MTSjzWGr/virtualmin-dns-options.png

I have trouble with configuring outgoing emails, they are working internally. If i try to send email from info@koordinacijahumanitaraca.net to test@koordinacijahumanitaraca.net they are working nice sending and receiving.

When i try to send to gmail or any other mail i can’t send mails.

Postfix is running and i got this error message when i try to send email to any outside domain or service provider, they don’t end up in spam folder either.

Postifx error - https://i.postimg.cc/PxTNB26g/postfix-error.png

What is configured wrong? Is it DNS records? Let’s encrypt is working for fqdn, cloudflare proxy is turned off. Email reciving is working but I can’t send emails.

host -t MX koordinacijahumanitaraca.net
host mail.koordinacijahumanitaraca.net

https://i.postimg.cc/7Zz6hpjv/host-mx.png
https://i.postimg.cc/CKVKqcVR/host-mail.png

Other maybe usefull informations:

Should I turn DNS on Webmin and Virtualmin and use Cloudflare only? Please help, any kind pieces of information are most welcome, and if you need any log or piece of information please let me know.

I would like to know what am I doing wrong here :frowning:

Thanks in advance.

https://docs.hetzner.com/cloud/servers/faq/#why-can-i-not-send-any-mails-from-my-server

Turn your SSL/TLS on Cloudflare to Flexible instead of Full and try it again. If it works, then there’s something up with your certificate or its configuration.

@Gomez_Adams thanks for info.
Did not help when on flexible, all SSL certificates are Let’s Encrypt even hostname. R3 certificates across all server, and CF on DNS only.

@dimitrist it’s the first month so I’ll have to wait and open requests for ports to open.
I’ve managed to send mail over gmail smtp(Laravel 9).
But still emails from local to gmail are not working :frowning:

I’ve copied SPF and DMARC records over from Virtualmin to Cloudflare DNS records, MX as well.

Cloudflare DNS with TXT records from Webmin/Virtualmin

Virtualmin DNS records:

Email logs:

Still, emails are working locally but when I try to send them to Gmail or vice versa I got errors, they can’t be delivered either way.

thats outbound traffic being timeout, i don’t think cloudflare would effect that. do ping tests on the server to gmail. If ping ok. Then check if SMTP is open. https://portchecker.co/
P.S. port 25 if blocked. That needs to be open.

@dimitrist

U were right, I just thought I’ve misconfigured something, sorry.

I’ve managed to send emails via google SMTP and 587(Laravel 9 app).

@stefan1959

Port 25 is blocked indeed, I will give it a week and a half and see if the ports are good then.

Thank you all for your help.

1 Like

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.