Email issues on a new setup

SYSTEM INFORMATION
OS type and version: Rocky Linux 8.4
Webmin version: Webmin version 1.973
Virtualmin version: Virtualmin version 6.16
Related products version: All applications referred to herein are updated to the latest version and verified with dnf.

Other considerations: I am running my DNS through CloudFlare. This is a new server less than a week from new installation, so I’m in the process of setting everything up.

Goal: I am attempting to use Postfix and Dovecot to use email services through my dedicated server running Virtualmin and received to my Gmail inbox for sending and receiving to/from the server.

Issue: Gmail is unable to connect to the email server and gives an error: Couldn’t reach server. Please double-check the server and port number.

Things I have done:

(all instances of dot com changed to tld to get past the new user links filter)

  • lsof -i -P -n | grep LISTEN: server is listening on 25, 587, 465, 110, 143, and 995.
  • Added MX record to CloudFlare:
    name: latenitebooks(tld) mailserver: mail.latenitebooks(tld) TTL: auto Priority: 5
  • A record for mail:
    name: mail content: 104.251.122.47 TTL: auto (proxied with CloudFlare)
  • Created User under the virtual server and configured the user and password.

Attempting to login to Gmail:
username: tried user by itself, user@latenitebooks(tld)
mailserver: tried mail.latenitebooks(tld) and latenitebooks(tld)
port: tried all 3 ports.
authentication: highest available for each port option (so TLS when available, if not, SSL)

I do not want to attempt any non-secure/unencrypted options, even for testing purposes.

Thank you for any help with this issue.

I am aware of using Gmail’s SMTP for free for clients, but I had always thought to use it as a server application you had to have a Google Workspace account and set it up through there.

I may be wrong on that, but that was my understanding of it.

In this case, Gmail isn’t being used as the server. I have a dedicated server running Rocky Linux 8.4 which hosts the email services. Gmail is just my mail client, and it can be setup to send and receive through the server remotely. This is mainly to keep all of my email in one place/one inbox, since my Gmail account is my main/personal/private email.

Each email is setup as an alias with labels, so my regular Gmail mail comes in without a label, and each connected alias account comes in with a label, all in the same list, color coded by label.

Hi @kittrellbj ,

do you use your (A(AAA)-Record) mail.yourdomain.tld with the Cloudflare proxy?
If that is the case, maybe you should put it to DNS only, wait 5 minutes and check it again if that will work.

Cheers

I will give it a shot and report back here what happens.

I tried after changing the A record to DNS only with mail.lnb.tld and lnb.tld using ports 25, 465, and 587, TLS or SSL as the top level security sign on. Still producing the same error message.

One thing I noticed is that when using the mail.lnb.tld, the error pops up instantly. When using lnb.tld, it takes a while before it gives the error. Reporting this in case it is significant.

I understand that. What I’m getting at is that if you want to use Gmail SMTP on a server you have to change the actual Postfix configuration file to do that. Otherwise you can just use your Google SMTP on your mail client configuration.

You edit the main.cf file of Postfix and add the lines to the relayhost line for Gmail.

relayhost = [smtp.gmail.com]:587
smtp_sasl_auth_enable = yes
smtp_sasl_password_maps = hash:/etc/postfix/sasl_passwd
smtp_sasl_security_options = noanonymous
smtp_tls_CAfile = /etc/postfix/cacert.pem
smtp_use_tls = yes

Did you already do that?

Edit to add: there’s a whole writeup here on how to do it in Ubuntu. I can only assume it would be the same in Rocky because it’s not down to the server itself it’s about Postfix.

https://devanswers.co/configure-postfix-to-use-gmail-smtp-on-ubuntu-16-04-digitalocean-droplet/

No, I had no idea that these steps were involved. The fact that I was ever able to get email working before must have been some kind of lucky accident, then. I will try these steps you’ve posted this evening when I get home from work and report back.

1 Like

So I started going through the instructions, and I saw that this is not quite the configuration I’m looking for. I am trying to login to the server to send and receive mail and using Gmail like you would use Outlook or some other mail client.

In Gmail, you can go to Settings > All Settings > Accounts. Under the Send Mail As area, you can set up accounts. These accounts behave exactly the same as a standalone email client. It logs into the accounts periodically, retrieves mail, sends mail, and logs out.

I don’t think the above information/guide will help me accomplish this.

Well, good luck in your efforts! Be sure to repost when you get it figured out for anybody else trying to do your setup.

So I have been working through the issue a bit today, trying random things, trying troubleshooting tools, and trying other ways to produce errors. I was able to hook up to the POP3 service remotely, but not the SMTP service. I believe that Dovecot can speak through Cloudflare but Postfix cannot because I was able to connect via POP3, but not via SMTP.

Almost a day later, the DNS record is still reflecting Cloudflare IPs when I perform DNS lookup, so what I believe will happen–once DNS propagates and reflects Cloudflare providing DNS only and no proxy–that the email service will start working as intended.

I will of course make a final report (or new findings/errors) here when the DNS has propagated.

Out of curiosity, have you gone up to Cloudflare and emptied the entire cache?

I have not. I just started using Cloudflare on this new server, so I wasn’t aware it was an option. I will do that now.

It’s sort of hidden. You go to caching then to the configuration tab at the far right and hit ‘purge everything’.

Although the DNS still has not propagated, I have tested smtp connectivity directly to the IP address and found that it will connect properly and not return (many) errors. I do have to enable TLS, as it is reported to be not working, but I believe this was the issue at hand, a problem with Cloudflare and the DNS settings.

Edit to add: Forgot to mention that the TLS mode may start working on its own as soon as the DNS issue is resolved because certificates have already been issued for mail.lnb.tld. But they would not be verified properly accessing the server through its IP, thus no TLS mode.

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