Home Technical ArticlesHow to Fix “Connection Refused (111) – Can’t Open SMTP Stream” Error

How to Fix “Connection Refused (111) – Can’t Open SMTP Stream” Error

by SupportPRO Admin
Message Not Sent

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 messages are transmitted to the recipient’s mail server efficiently. SMTP typically operates on ports 25, 465, and 587, and is responsible only for sending emails. For receiving emails, protocols like IMAP and POP3 are used.

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.

Understanding the Error

If you encounter the error:

“Message not sent. Server replied: Connection refused (111) – Can’t open SMTP stream”

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.

This issue is most commonly caused by:

  • Disabled or missing SMTP ports in the mail server configuration
  • Firewall restrictions blocking SMTP ports
  • Exim service not running or misconfigured
  • Incorrect mail server settings in the application

How to Fix the Issue in Exim

In most cases, this error occurs due to incorrect SMTP port configuration in the Exim mail server. Follow the steps below to resolve it:

1. Open the Exim Configuration File

Access your server via SSH and open the Exim configuration file:

vi /etc/exim.conf

2. Locate the SMTP Ports Configuration

Search for the following line in the file:

#daemon_smtp_ports = 25 : 587

3. Enable the Required Ports

Remove the # to uncomment the line:

daemon_smtp_ports = 25 : 587

4. Add the Entry (If Missing)

If the above line is not present in the file, add it manually to ensure Exim listens on the required ports.

5. Restart the Exim Service

After saving the changes, restart Exim to apply the configuration:

service exim restart

Additional Checks

If the issue still persists after updating the configuration, consider the following checks:

  • Firewall Settings: Ensure ports 25 and 587 are open and not blocked
  • Service Status: Verify Exim is running using: service exim status
  • Port Listening: Confirm Exim is listening on the correct ports: netstat -tulnp | grep exim
  • Application Configuration: Double-check SMTP settings in your application (host, port, authentication)

Conclusion

This error typically occurs when SMTP ports are not properly enabled or accessible in Exim. By configuring ports 25 and 587 correctly and ensuring there are no external restrictions, you can quickly restore email sending functionality.

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’s best to consult our server administrator or a professional support team for deeper troubleshooting.

Partner with SupportPRO for 24/7 proactive cloud support that keeps your business secure, scalable, and ahead of the curve.

Contact Us today!
guy server checkup

You may also like

Leave a Comment