Select Page

How to fix Amazon AWS EC2 Connection timed out error in SMTP

Here at Bobcares, we provide Server Administration and Maintenance services to AWS account owners.

An error we sometimes see in Amazon EC2 instances is : Connection timed out error in SMTP

This is usually caused due to various reasons such as mail server security restrictions, network routing issues or even port blocks at ISP or AWS levels.

What is AWS EC2 “Connection timed out” error in SMTP ?

When you or your customers try to send mails using your mail server in the AWS EC2 instance, it performs a series of steps like establishing connection to the mail server and delivering the mails.

This includes authenticating an email account, verifying the email server settings, invoking the mail transfer and delivery agents, connecting to the remote mail server, and so on.

If any of those steps fail for a hundred different reasons, the mail delivery process fails.

Today, we’ll look at the top few reasons for this failure, and the fixes for it:


Resolving AWS EC2 “Connection timed out” error in SMTP

This happens because the email account user is unable to connect to the mail server.

For example, when a user is trying to send mails via Outlook, he’ll see the error:

AEA7C9A7D49 19539 Fri Feb 18 11:12:20
(connect to[***.**.***.31]:25: Connection timed out)

To resolve this error, first we need to determine the cause of the error. Local connectivity issues, AWS throttling for port 25 on EC2 instances, server firewalls or mail server misconfiguration, anything can lead to such errors.

If you are facing this error, and need help, click here to request expert assistance.


How to fix AWS EC2 “Connection timed out” error in SMTP

This error occurs mainly due to 3 main reasons:

  • Email client unable to connect to the mail server
  • AWS limiting the connections to port 25 of SMTP server
  • Email server unable to connect to remote mail server

Three variations of this error are:

  • status=deferred (connect to[***.*.***.12]:25: Connection timed out)

  • postfix/smtp[1261]: connect to[***.*.***.12]:25: Connection timed out

  • qmail: 1291975084.251298 delivery 1234: deferral: Sorry,_I_wasn’t_able_to_establish_an_SMTP_connection._(#4.4.1)

All these happen because of some connectivity issue between the email sender and the recipient mail server – possibly due to a server misconfiguration, port blocks or connectivity issues.

To fix this, you’ll need to verify the connectivity from sender’s PC to mail server, check the firewall rules in server and confirm that there are no connectivity issues or throttling set within the EC2 instance.

Things can get messed up when editing firewall rules or mail server configuration files. So the edits have to be done carefully.

However, if you need help, our server experts can fix this for you in an hour. Click here to go to our server administration services page.


Fixing the “Connection timed out” error in SMTP

For users to send mails via AWS EC2 instances, the mail server connectivity and the SMTP ports should be working fine. This include allowing SMTP port in the firewalls, ensuring proper network connectivity in EC2, resolving DNS issues, etc.

Even a slight misconfiguration in the mail server or email client settings can cause email delivery to fail.

If you are debugging an email connectivity error, make sure the mail server is working fine and SMTP ports are allowed. If the error is obtained while connecting to remote mail server, confirm that network connectivity is fine.

In case the issue persists, look up the mail server IP address and AWS EC2 throttling limits.

Email errors can also be caused by mail server configuration issues or email routing problems.

If you need help, our server experts are on standby 24/7. Click here to open a server administration request.



“Connection timed out” error in SMTP  is a class of errors in AWS EC2 instances. It is shown when mail server is unable to connect with the network or due to Amazon’s port limits. Today we’ve seen the common causes for this error, and how to fix them.


Our server experts will resolve your email errors, prevent spamming, configure firewall rules, and tweak your services, so that you never have to worry about email errors again.

Contact us for expert assistance!


Submit a Comment

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

Bobcares is a server management company that helps businesses deliver uninterrupted and secure online services. Our engineers manage close to 51,500 servers that include virtualized servers, cloud infrastructure, physical server clusters, and more.

Privacy Preference Center


    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]


    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


    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

    IDE, test_cookie, 1P_JAR, NID, DV, NID
    IDE, test_cookie
    1P_JAR, NID, DV