I can't send mails to gmail or hotmail

I have created a new virtual server several times and in none of them have I been able to send mails to gmail or hotmail. I can recive correctly.
OS: Debian 9 netinst

Procedure: I simply create a new virtual server from virtualmin, then install roundcube from the script that comes by default in virtualmin and then I create a new user called felipe

I am using a DNS in cloudflare. It is configured like this:

I don’t know exactly what logs to show you, please ask me what you need

Hi Felipe,
Your emails are quite likely either being rejected or sent to spam by the receiving mail server because your configuration is correct.

Usually you need the the following:

  1. Reverse ptr (setup via your vps service provider dashboard)
  2. spf record (dns)
  3. _DMARC (dns)
  4. DKIM (dns…this is often advised but optional)

The reverse ptr is also linked with your vps provider and is setup through their interface prior to configuring Virtualmin and adding spf record into dns.

One way to check is via mxtoolbox.com

It also has a tool to help you create missing the records (although not obvious through mxtoolbox interface…I usually Google it)


Oops I forgot, you must get the main mail server configuration correct before any of the Virtual server mails will work. They rely on the parent webmin system mail to be correctly configured. Thus means your mail server itself should have the correct reverse ptr at vps provider dashboard + spf, _DMARC, and dkim records setup.

If the mail server itself is wrong, nothing will work on any virtual servers.

Thank you very much for your quick response!

I am not using any VPS, I have my own server so the only way to configure my DNS is with CloudFlare.

I’m going to try adding the records you recommend (the PTR record is already set, I don’t know if it’s correct)

whether or not you use vps doesn’t matter…reverse ptr is mandatory.

see following links for dmarc and spf



May I also inquire as to why you say
I have my own server so the only way to configure my DNS is with CloudFlare.

That is not true, your virtualmin server is already running Bind DNS by default.

Even if you don’t use BInd on your Virtualmin system, a lot of domain registrars offer free dns hosting with each domain.

So you can use your domain registrar’s free dns hosting to control this. All that is required is to log into your Domain registrars dashboard and add all of your DNS records (that you currently have at cloudflare) via your registrar domain control panel. This is by far the simplest method of doing this as my understanding is that Cloudflare causes some complications that need some workarounds!

Thanks again, using the recommended links I have reached the following DNS configuration:


Unfortunately I still can’t send emails to gmail or hotmail.

I have passed the test provided by mxtoolbox and I have obtained the following results:


For some reason I am on three blacklists.
I am using a dynamic IP that I update in DNS with ddclient, I have read that this can be a problem but it is the only way I have to put my servers on the internet.

I can’t get a static IP because my ISP doesn’t give it to me.

I keep waiting for more help. Thank you very much for all the time spent, I am new to the configuration of email servers and it is really helping me to use Virtualmin together with your tips

You are really right, but as you can see I am using free TK domains for the tests. They are obtained from FreeNom and I have not been able to dynamically update my IP in its DNS, for this reason I use cloudflare (And by recommendations of friends).

I have written a comment above with some progress

Ah yes I see.
Don’t forget to also check you webmin/logs…specifically those to do with your mail server software (ie make sure postfix is working).

There are documents here on Virtualmin.com that should help you ensure its all ok.

Let me just add, trying to do with with dhcp rather than static IP isn’t ideal…I am not sure exactly what issues that will cause, however perhaps you being blacklisted might be one of them?

Free domain I am not sure about how this works with mail exactly?

I think at this point I will leave others to help further as I don’t use cloudflare either.

I am sorry I cannot help you more, however your setup is not a standard one which makes this a bit difficult as you may need a few workarounds for your emails to get delivered properly.

My suggestion to you would be to get a cheap vps…ie vultr.com have a small vps for as little as $10 month…and this server is perfect for virtualmin.

Finally I have been able to confirm that the problem is the bad reputation of the IPs that my ISP gives. They are public and dynamic, and requesting a static IP from my ISP tells me they don’t have this service …