Unable to connect to AWS EC2 instance on port 25 (SMTP) for sending emails from Bitbucket Cloud Pipelines
Platform Notice: Cloud - This article applies to Atlassian products on the cloud platform.
Summary
Unable to connect to AWS EC2 instance on port 25 (SMTP) for sending emails from Bitbucket Cloud Pipelines and it throws the below error:
com.sun.mail.util.MailConnectException: Couldn't connect to host, port: domain.com, 25; timeout -1;
Caused by: java.net.ConnectException: Connection timed out (Connection timed out)
Cause
AWS blocks outbound traffic on port 25 (SMTP) of all EC2 instances and Lambda functions by default. Due to this restriction, the connection timed out occurs in the Bitbucket Pipelines.
Solution
- Remove the default restriction on port 25 for the AWS EC2 instance.
→ Reference: How do I remove the restriction on port 25 from my Amazon EC2 instance or AWS Lambda function? - You may use a different port for connection other than port 25.
Last modified on Jan 26, 2024
Powered by Confluence and Scroll Viewport.