Author Topic: My mail server returns "Connection refused" when adding my email to Gmail  (Read 2570 times)

0 Members and 1 Guest are viewing this topic.

Hi everyone,
if you are reading this, it means you might have encountered the same error as I did. This is a solution to the issue and not a question.

Description:
I recently moved my server from Digital Ocean to Contabo, and I set up all mail accounts and made sure it was sending and receiving emails, by sending an email to my Gmail account from the recently created server which I received and replied back to successfully. Where I started having issues was with adding the email to Gmail via pop settings. I was able to do this on my outlook application, but the issue was with Gmail not connecting to the server. The response Gmail receives whenever I try to connect is "Server error: Connection refused", which made me believe it was an issue with the connection being blocked.

After going through my security app logs to see if any of them was the culprit, I was not able to find anything. I even checked my server firewall and that wasn't the issue as I was able to connect with other clients. After searching on google for a while, I found a solution here https://efod.se/dovecot-postfix-ipv6/. which says you should set the following configuration in /etc/dovecot/dovecot.conf
Code: [Select]
listen=[::]I did this, and it worked. I was able to add the account to Gmail, but a new issue appeared. I was not able to log in to the email via RoundCube or other clients. This was because changing it to the above code made it listen on only IPv6. To fix this I had to combine both the code above and the previous value, which looks like the below code.
Code: [Select]
listen = *, [::]I was able to add emails to Gmail via POP and I was able to access it with other email clients.