{"id":500,"date":"2011-07-27T23:40:20","date_gmt":"2011-07-28T05:40:20","guid":{"rendered":"http:\/\/blog.supportpro.com\/?p=500"},"modified":"2026-03-24T23:29:37","modified_gmt":"2026-03-25T05:29:37","slug":"fix-connection-refused-111-cant-open-smtp-stream-error","status":"publish","type":"post","link":"https:\/\/www.supportpro.com\/blog\/fix-connection-refused-111-cant-open-smtp-stream-error\/","title":{"rendered":"How to Fix \u201cConnection Refused (111) \u2013 Can\u2019t Open SMTP Stream\u201d Error"},"content":{"rendered":"\n<p><strong>SMTP (Simple Mail Transfer Protocol)<\/strong> is the standard protocol used to send emails across the internet. It acts as a bridge between email clients and mail servers, ensuring that outgoing messages are transmitted to the recipient\u2019s mail server efficiently. SMTP typically operates on ports <strong>25, 465, and 587<\/strong>, and is responsible only for sending emails. For receiving emails, protocols like <strong>IMAP<\/strong> and <strong>POP3<\/strong> are used.<\/p>\n\n\n\n<p>A properly configured SMTP service is essential for smooth email delivery. This includes correct port settings, authentication, and server permissions. If any of these are misconfigured, it can lead to errors such as failed email delivery, connection timeouts, or authentication failures.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>Understanding the Error<\/strong><\/h2>\n\n\n\n<p>If you encounter the error:<\/p>\n\n\n\n<p><strong>\u201cMessage not sent. Server replied: Connection refused (111) \u2013 Can\u2019t open SMTP stream\u201d<\/strong><\/p>\n\n\n\n<p>it usually indicates that your mail server is refusing SMTP connections. This means that the application attempting to send the email cannot establish a connection with the mail server on the required port.<\/p>\n\n\n\n<p>This issue is most commonly caused by:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Disabled or missing SMTP ports in the mail server configuration<\/li>\n\n\n\n<li>Firewall restrictions blocking SMTP ports<\/li>\n\n\n\n<li>Exim service not running or misconfigured<\/li>\n\n\n\n<li>Incorrect mail server settings in the application<\/li>\n<\/ul>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>How to Fix the Issue in Exim<\/strong><\/h2>\n\n\n\n<p>In most cases, this error occurs due to incorrect SMTP port configuration in the Exim mail server. Follow the steps below to resolve it:<\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>1. Open the Exim Configuration File<\/strong><\/h3>\n\n\n\n<p>Access your server via SSH and open the Exim configuration file:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>vi \/etc\/exim.conf<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>2. Locate the SMTP Ports Configuration<\/strong><\/h3>\n\n\n\n<p>Search for the following line in the file:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>#daemon_smtp_ports = 25 : 587<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>3. Enable the Required Ports<\/strong><\/h3>\n\n\n\n<p>Remove the <code>#<\/code> to uncomment the line:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>daemon_smtp_ports = 25 : 587<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>4. Add the Entry (If Missing)<\/strong><\/h3>\n\n\n\n<p>If the above line is not present in the file, add it manually to ensure Exim listens on the required ports.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>5. Restart the Exim Service<\/strong><\/h3>\n\n\n\n<p>After saving the changes, restart Exim to apply the configuration:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>service exim restart<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>Additional Checks<\/strong><\/h2>\n\n\n\n<p>If the issue still persists after updating the configuration, consider the following checks:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>Firewall Settings:<\/strong> Ensure ports 25 and 587 are open and not blocked<\/li>\n\n\n\n<li><strong>Service Status:<\/strong> Verify Exim is running using: service exim status<\/li>\n\n\n\n<li><strong>Port Listening:<\/strong> Confirm Exim is listening on the correct ports: netstat -tulnp | grep exim<\/li>\n\n\n\n<li><strong>Application Configuration:<\/strong> Double-check SMTP settings in your application (host, port, authentication)<\/li>\n<\/ul>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>Conclusion<\/strong><\/h2>\n\n\n\n<p>This error typically occurs when SMTP ports are not properly enabled or accessible in Exim. By configuring ports <strong>25<\/strong> and <strong>587<\/strong> correctly and ensuring there are no external restrictions, you can quickly restore email sending functionality.<\/p>\n\n\n\n<p>Taking a few extra steps to verify firewall rules, service status, and application settings can help prevent similar issues in the future. If the problem continues, it\u2019s best to <a href=\"https:\/\/www.supportpro.com\/requestquote.php\" title=\"\">consult our server administrator<\/a> or a professional support team for deeper troubleshooting.<\/p>\n\n\n\n<p class=\"has-text-align-center\"><span id=\"hs-cta-wrapper-9d590242-d641-4383-94b4-8cfd62f0af6b\" class=\"hs-cta-wrapper\"><span id=\"hs-cta-9d590242-d641-4383-94b4-8cfd62f0af6b\" class=\"hs-cta-node hs-cta-9d590242-d641-4383-94b4-8cfd62f0af6b\"><a href=\"https:\/\/cta-redirect.hubspot.com\/cta\/redirect\/2725694\/9d590242-d641-4383-94b4-8cfd62f0af6b\"><\/a><\/span><\/span><\/p>\n\n\n\n<div class=\"wp-block-media-text alignwide has-media-on-the-right is-stacked-on-mobile is-vertically-aligned-center has-white-background-color has-background\"><div class=\"wp-block-media-text__content\">\n<p class=\"has-large-font-size\">Partner with <strong>SupportPRO<\/strong> for 24\/7 proactive cloud support that keeps your business secure, scalable, and ahead of the curve.<\/p>\n\n\n\n<!--HubSpot Call-to-Action Code --><span class=\"hs-cta-wrapper\" id=\"hs-cta-wrapper-3350a795-db50-482f-9911-301930d1b1be\"><span class=\"hs-cta-node hs-cta-3350a795-db50-482f-9911-301930d1b1be\" id=\"hs-cta-3350a795-db50-482f-9911-301930d1b1be\"><!--[if lte IE 8]><div id=\"hs-cta-ie-element\"><\/div><![endif]--><a href=\"https:\/\/cta-redirect.hubspot.com\/cta\/redirect\/2725694\/3350a795-db50-482f-9911-301930d1b1be\" ><img decoding=\"async\" class=\"hs-cta-img\" id=\"hs-cta-img-3350a795-db50-482f-9911-301930d1b1be\" style=\"border-width:0px;\" src=\"https:\/\/no-cache.hubspot.com\/cta\/default\/2725694\/3350a795-db50-482f-9911-301930d1b1be.png\"  alt=\"Contact Us today!\"\/><\/a><\/span><script charset=\"utf-8\" src=\"https:\/\/js.hscta.net\/cta\/current.js\"><\/script><script type=\"text\/javascript\"> hbspt.cta.load(2725694, '3350a795-db50-482f-9911-301930d1b1be', {\"useNewLoader\":\"true\",\"region\":\"na1\"}); <\/script><\/span><!-- end HubSpot Call-to-Action Code -->\n<\/div><figure class=\"wp-block-media-text__media\"><img fetchpriority=\"high\" decoding=\"async\" width=\"904\" height=\"931\" src=\"https:\/\/www.supportpro.com\/blog\/wp-content\/uploads\/2022\/09\/Free-server-checkup.png\" alt=\"guy server checkup\" class=\"wp-image-12943 size-full\" srcset=\"https:\/\/www.supportpro.com\/blog\/wp-content\/uploads\/2022\/09\/Free-server-checkup.png 904w, https:\/\/www.supportpro.com\/blog\/wp-content\/uploads\/2022\/09\/Free-server-checkup-291x300.png 291w, https:\/\/www.supportpro.com\/blog\/wp-content\/uploads\/2022\/09\/Free-server-checkup-768x791.png 768w, https:\/\/www.supportpro.com\/blog\/wp-content\/uploads\/2022\/09\/Free-server-checkup-585x602.png 585w\" sizes=\"(max-width: 904px) 100vw, 904px\" \/><\/figure><\/div>\n","protected":false},"excerpt":{"rendered":"<p>SMTP (Simple Mail Transfer Protocol) is the standard protocol used to send emails across the internet. It acts as a bridge between email clients and mail servers, ensuring that outgoing&hellip;<\/p>\n","protected":false},"author":4,"featured_media":16524,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_lmt_disableupdate":"","_lmt_disable":"","footnotes":""},"categories":[3],"tags":[],"class_list":["post-500","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-technical-articles"],"aioseo_notices":[],"_links":{"self":[{"href":"https:\/\/www.supportpro.com\/blog\/wp-json\/wp\/v2\/posts\/500","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.supportpro.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.supportpro.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.supportpro.com\/blog\/wp-json\/wp\/v2\/users\/4"}],"replies":[{"embeddable":true,"href":"https:\/\/www.supportpro.com\/blog\/wp-json\/wp\/v2\/comments?post=500"}],"version-history":[{"count":5,"href":"https:\/\/www.supportpro.com\/blog\/wp-json\/wp\/v2\/posts\/500\/revisions"}],"predecessor-version":[{"id":16528,"href":"https:\/\/www.supportpro.com\/blog\/wp-json\/wp\/v2\/posts\/500\/revisions\/16528"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.supportpro.com\/blog\/wp-json\/wp\/v2\/media\/16524"}],"wp:attachment":[{"href":"https:\/\/www.supportpro.com\/blog\/wp-json\/wp\/v2\/media?parent=500"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.supportpro.com\/blog\/wp-json\/wp\/v2\/categories?post=500"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.supportpro.com\/blog\/wp-json\/wp\/v2\/tags?post=500"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}