Failed to send email, Check your configuration settings: Connection unexpectedly closed

Satish Kumar March 3, 2023

Failed to send email: Check your configuration settings: Connection unexpectedly closed: The read operation timed out

I am using atlassian/email-notify:0.8.0

My Pipeline Script is:

script:
- pip install pytest
# - pip install pytest-html
- pytest -v -s test.py --junitxml=./test-reports/report.xml
after-script:
- apt-get update && apt-get install -y zip
- zip -r test-reports.zip test-reports
- ALERT_TYPE="SUCCESS"
- if [[ $BITBUCKET_EXIT_CODE -ne 0 ]]; then ALERT_TYPE="FAILURE" ; fi
- pipe: atlassian/email-notify:0.8.0
variables:
USERNAME: 'satishk@gmail.com'
PASSWORD: ${PASSWORD}
FROM: 'satishk@gmail.com'
TO: 'dj.duraj@gmail.com'
HOST: 'smtp-mail.outlook.com'
PORT: 587
DEBUG: 'true'
SUBJECT: '${ALERT_TYPE}:Bitbucket Pipe Notification for ${BITBUCKET_BRANCH} branch of ${BITBUCKET_WORKSPACE}'
BODY_PLAIN: 'Hello Team,<br>
Please Find the attachement of <b>${ALERT_TYPE}</b> report of current pipeline status.'
ATTACHMENTS: 'test-reports.zip'

1 answer

0 votes
Patrik S
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
March 7, 2023

Hello @Satish Kumar ,

Welcome to Atlassian Community!

From the pipe configuration you shared, it seems like you are sending the e-mail from a Gmail account, but you have configured the HOST variable with the SMTP address of Outlook. 

In order to send an e-mail from a gmail account, you will need to configure the HOST with Gmail's STMP address, which is smtp.gmail.com. Following is an example using Gmaiils configuration in the pipe : 

- pipe: atlassian/email-notify:0.8.0
    variables:
      USERNAME: 'myemail@gmail.com'
      PASSWORD: $PASSWORD
      FROM: 'myemail@gmail.com'
      TO: 'example@example.com'
      HOST: 'smtp.gmail.com'
      PORT: 587
      SUBJECT: 'Bitbucket Pipe Notification for your-bitbucket-pipeline'

Please note that due to changes in Google not supporting less secure apps (see Google changes for less secure apps), to make this pipe work with a Google account, you will to create a Google app password.

For more details and examples of using the atlassian/email-notify pipe, you can check its official documentation in the link below : 

Hope that helps! 

Thank you, @Satish Kumar !

Patrik S

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PERMISSIONS LEVEL
Site Admin
TAGS
AUG Leaders

Atlassian Community Events