Unable to send email using bitbucket email pipe
Asked by Victoria Munroe:

I am trying to add the email pipe to send out a notification (via outlook) when a build passes or fails but I keep running into an issue.  

```
image: atlassian/default-image:3

pipelines:

default:

 - step:

runs-on:

 - self.hosted

 - windows

name: 'Build and Test'

script: 

#Build Project

 - cmd.exe /c runprog.cmd



 - step:

name: Notification


script:

 - echo "Sending Status"

 - pipe: atlassian/email-notify:0.7.0

variables:

USERNAME: jane@outlook.com

PASSWORD: $pass

FROM: $user

TO: $user

HOST: 'smtp-mail.outlook.com'

PORT: '587'
```

    Error Message:

    Unable to find image 'bitbucketpipelines/email-notify:0.7.0' locally

    0.7.0: Pulling from bitbucketpipelines/email-notify

    214ca5fb9032: Pulling fs layer

    fa7d81b69b9a: Pulling fs layer

    2fd9be6893d2: Pulling fs layer

    7c8f45ffebd6: Pulling fs layer

    bd5d81492901: Pulling fs layer

    503c4e2633c0: Pulling fs layer

    52aeffd8d780: Pulling fs layer

    76cad53dd78c: Pulling fs layer

    8584b165b8ce: Pulling fs layer

    503c4e2633c0: Waiting

    52aeffd8d780: Waiting

    76cad53dd78c: Waiting

    7c8f45ffebd6: Waiting

    8584b165b8ce: Waiting

    bd5d81492901: Waiting

    fa7d81b69b9a: Download complete

    2fd9be6893d2: Verifying Checksum

    2fd9be6893d2: Download complete

    7c8f45ffebd6: Download complete

    214ca5fb9032: Verifying Checksum

    214ca5fb9032: Download complete

    503c4e2633c0: Verifying Checksum

    503c4e2633c0: Download complete

    76cad53dd78c: Verifying Checksum

    76cad53dd78c: Download complete

    52aeffd8d780: Verifying Checksum

    52aeffd8d780: Download complete

    8584b165b8ce: Verifying Checksum

    8584b165b8ce: Download complete

    214ca5fb9032: Pull complete

    fa7d81b69b9a: Pull complete

    bd5d81492901: Verifying Checksum

    bd5d81492901: Download complete

    2fd9be6893d2: Pull complete

    7c8f45ffebd6: Pull complete

    bd5d81492901: Pull complete

    503c4e2633c0: Pull complete

    52aeffd8d780: Pull complete

    76cad53dd78c: Pull complete

    8584b165b8ce: Pull complete

    Digest: sha256:01b6a5aee203517ae808631d3f59e1725f9ad7c737a3604d184c307d6a3a9d91

    Status: Downloaded newer image for bitbucketpipelines/email-notify:0.7.0

Edit:

The debug helps! The error message I'm receiving is  
? Failed to send email to victoria@google.com Check your configuration settings: (535, b'5.7.139 Authentication unsuccessful, basic authentication is disabled. [BL1PR13CA0365.namprd13.prod.outlook.com]') Any idea?


Answers:
author: Mark C
body: Hi [@Victoria Munroe](/t5/user/viewprofilepage/user-id/4945966)

Welcome to the community.

Based on my understanding, you'd like to send an email notification regardless if the step "Build and Test" is successful or failed.  
If my understanding is correct, I believe your YAML configuration will only send a notification if the step "Build and Test" is successful as it will proceed to the next step but if it failed, it will not run the next step which is "Notification".

For this, I'd suggest using the configuration called [**after-script**](https://bitbucket.org/blog/after-scripts-now-available-for-bitbucket-pipelines) instead.  
This will allow you to run scripts regardless of whether the step succeeds or fails.

Here's a sample step config:

```
      - step:          runs-on:            - self.hosted            - windows          name: 'Build and Test'          script:            - cmd.exe /c runprog.cmd          after-script:            - echo "Sending Status"            #- Your Pipes script here (e.g. atlassian/email-notify:0.7.0)
```

Also for the error message, it is expected or normal to mention that the Docker image "bitbucketpipelines/email-notify:0.7.0" is not found as the step container will download/pull it later on.

Additionally, if you'd like to debug your Pipes script (atlassian/email-notify:0.7.0), you could also add the variable **DEBUG: 'true'** so you get more logs when you run it.

Hope it helps and let me know how it goes.

Regards,  
Mark C

comments: author: Victoria Munroe
body: It won't let me post the error here but I've included the full error message (above in main question) I have gotten after debug do you know what may cause a 'basic authentication is disabled' error?


author: Mark C
body: Hi [@Victoria Munroe](/t5/user/viewprofilepage/user-id/4945966)

Based on the updated debug error message, it appears the SMTP server's basic authentication is disabled for the email you used in the Pipes script(atlassian/email-notify:0.7.0).

For this, you may want to check this with your email administrator/provider to ensure the SMTP server accepts basic authentication for the specific email.

Hope it helps and please do let me know if you have further questions that I can help with.

Regards,  
Mark C


Tags: bitbucket-cloud

bitbucket-pipelines

cloud

notification