Bobcares

Trouble with IMAP Connection refused error – Here’s how to fix it!

by | Mar 1, 2019

Having a lot of trouble with my email account. It’s shows IMAP Connection refused error every time. What’s actually happening?

That was a recent support ticket received at our Dedicated Support Services department where we help server owners resolve critical errors on their servers.

Website owners usually receive this error due to IMAP configuration issues, firewall restrictions and more.

Today, we’ll see the top 4 reasons for this error and how we fix them.

IMAP connection refused – What this means?

IMAP connection refused error means that the IMAP server rejected the connection made by the email application. Users commonly see this error when they access their emails through any webmail clients such as Squirrelmail, Roundcube, etc.

And, they see the entire error message like this.

Error connecting to IMAP server: localhost.
111 : Connection refused

 

Here, our Support Experts check the server logs(/var/log/messages) and the email logs(/var/log/maillog or /usr/local/psa/var/log/maillog) to determine the source of the problem.

 

IMAP Connection refused – Causes and Fixes

Now, let’s discuss the top 4 reasons for this error and how our Support Experts rule out each possibility.

1) Service downtime

One of the main reasons for this error is IMAP service not running on the server. Common IMAP servers are Dovecot, Courier-IMAP, etc. IMAP service allows users to access the emails from anywhere. So, if the IMAP service crashes, the connection fails and result in IMAP connection refused errors.

How we fix?

Service downtime can occur due to traffic spikes, resource outages, spamming, DDoS attacks, disk errors, and so on. So, here our Support Engineers identify the reason and permanently fix it.

For example, if we there’s high load on the server, we first identify the resource that is being abused. Further, we identify the user abusing this resource and disable it.

Similarly, if we find any dead or non-responsive processes, we’ll kill those dead processes and restart the services. For example, on CentOS – cPanel servers, we restart the IMAP service using the below command.

service dovecot restart

 

Finally, we confirm that IMAP service is listening on the server using the netstat command.

netstat -plnt | grep :143

 

2) IMAP configuration issues

Similarly, configuration issues in the IMAP configuration file are another main reason for this error. Typo mistakes, syntax errors, incorrect parameters in the IMAP configuration can create errors. For example, users commonly see this error while restarting Dovecot service on the server.

Starting Dovecot Imap: doveconf: Fatal: Error in configuration file /etc/dovecot/dovecot.conf line 68: Unknown setting: default_mail_env

 

This shows that due to the configuration issues in the file /etc/dovecot/dovecot.conf, the dovecot service failed to start. This clearly shows there’s an invalid parameter default_mail_env in this file.

 

How we fix?

Here, our Hosting Experts check and correct the configuration issues in the IMAP configuration file. Most importantly, we ensure there’s a valid backup of the configuration file before making any changes.

Similarly in courier-imap servers, we run the service with default configuration. For that, we backup the original configuration file and replace it with /etc/courier-imap/imapd.dist. If it works fine, we compare the original file and .dist file and fix the errors.

Further, we make sure that the dovecot service has been restarted successfully and running fine in the server. Moreover, we make sure that we can login to the email account via any webmail clients such as Roundcube, Horde, etc.

 

3) Server firewall restrictions

Another probable reason for this error is faulty firewall configuration in the server. We’ve seen instances where remote server blocks connection from particular IP address or IP address ranges. Remote server blocks connections from an IP address due to abnormal activities, too many connections, etc.

Similarly, the default IMAP port is 143 and Secure IMAP port(SSL/TLS port) is 993. And, if these ports are not opened in the server, customers will receive this error.

 

How we fix?

Firstly, our Support Engineers ensure that the IP address of the customer isn’t blocked in the server firewall. For example, on cPanel servers, we use the below command to check if the customer’s IP address xx.xx.xx.xx is blocked.

csf -g xx.xx.xx.xx

 

And if it’s blocked, we’ll immediately remove the block and restore the email service for the customer. Later, we find the reason for the block and update the customer about the preventive actions to be taken.

Moreover, we get the telnet results from customer’s end to check the IMAP port connectivity.

telnet xx.xx.xx.xx 143
telnet xx.xx.xx.xx 993

 

And, we’ll remove the offending rule from the server firewall. In addition to that, we modify the firewall settings to accept valid connections on IMAP ports 143 and 993.

 

4) Firewall restrictions at local end

Similarly, another possibility is that firewall on the customer’s network or ISP blocks the port for IMAP. We’ve seen cases where third party firewall or Antivirus program on the systems block IMAP port.

 

How we fix?

If there are no problems at the server side, we update customers to disable the security applications like Windows firewall, Antivirus programs, etc. one by one. This helps us to identify which program is creating problems and fix it’s settings.

Alternatively, if the issue is at the ISP level, we get the traceroute and tcptraceroute results from the customer. This helps us to identify if the problem lies at the intermediate level.

 

Conclusion

In short, imap connection refused error can occur due to server firewall restrictions, IMAP configuration issues, and more. Today, we’ve discussed the top 4 reasons for thus error and how our Dedicated Engineers fix them.

PREVENT YOUR SERVER FROM CRASHING!

Never again lose customers to poor server speed! Let us help you.

Our server experts will monitor & maintain your server 24/7 so that it remains lightning fast and secure.

GET STARTED

var google_conversion_label = "owonCMyG5nEQ0aD71QM";

2 Comments

  1. Tanja

    Dear Sir,

    I have a big problem with Claws Mail. I cannot display my mail I have on my pc anymore. I need somebody who can help me. When I want to open it is said IMAP login refused.

    Please help me on Zoom to fix it with me. I will oay 30 Euro whenyou succeed.

    Thanks.

    Reply
    • Hiba Razak

      Hello Tanja,
      Please contact our support team via live chat(click on the icon at right-bottom).

      Reply

Submit a Comment

Your email address will not be published. Required fields are marked *

Never again lose customers to poor
server speed! Let us help you.

Privacy Preference Center

Necessary

Necessary cookies help make a website usable by enabling basic functions like page navigation and access to secure areas of the website. The website cannot function properly without these cookies.

PHPSESSID - Preserves user session state across page requests.

gdpr[consent_types] - Used to store user consents.

gdpr[allowed_cookies] - Used to store user allowed cookies.

PHPSESSID, gdpr[consent_types], gdpr[allowed_cookies]
PHPSESSID
WHMCSpKDlPzh2chML

Statistics

Statistic cookies help website owners to understand how visitors interact with websites by collecting and reporting information anonymously.

_ga - Preserves user session state across page requests.

_gat - Used by Google Analytics to throttle request rate

_gid - Registers a unique ID that is used to generate statistical data on how you use the website.

smartlookCookie - Used to collect user device and location information of the site visitors to improve the websites User Experience.

_ga, _gat, _gid
_ga, _gat, _gid
smartlookCookie
_clck, _clsk, CLID, ANONCHK, MR, MUID, SM

Marketing

Marketing cookies are used to track visitors across websites. The intention is to display ads that are relevant and engaging for the individual user and thereby more valuable for publishers and third party advertisers.

IDE - Used by Google DoubleClick to register and report the website user's actions after viewing or clicking one of the advertiser's ads with the purpose of measuring the efficacy of an ad and to present targeted ads to the user.

test_cookie - Used to check if the user's browser supports cookies.

1P_JAR - Google cookie. These cookies are used to collect website statistics and track conversion rates.

NID - Registers a unique ID that identifies a returning user's device. The ID is used for serving ads that are most relevant to the user.

DV - Google ad personalisation

_reb2bgeo - The visitor's geographical location

_reb2bloaded - Whether or not the script loaded for the visitor

_reb2bref - The referring URL for the visit

_reb2bsessionID - The visitor's RB2B session ID

_reb2buid - The visitor's RB2B user ID

IDE, test_cookie, 1P_JAR, NID, DV, NID
IDE, test_cookie
1P_JAR, NID, DV
NID
hblid
_reb2bgeo, _reb2bloaded, _reb2bref, _reb2bsessionID, _reb2buid

Security

These are essential site cookies, used by the google reCAPTCHA. These cookies use an unique identifier to verify if a visitor is human or a bot.

SID, APISID, HSID, NID, PREF
SID, APISID, HSID, NID, PREF