Showing results for 
Search instead for 
Did you mean: 
Sign up Log in
It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

Sending mail from docker image in pipeline



I am pulling down my own docker image from docker hub in bitbucket pipelines and would like to send mail from within the docker image

I am using mail command and everything works fine when running the docker image on my own computer. I am using gmail as the mail provider.

but when I do the same in pipeline it does not work. I don't get any error message or anything so that I would see what is actually wrong

I tried to put the debug logs on on the mail command but I don't get any output in pipeline

on my local laptop (wls2 on windows), I get some debug log output and like said before it works fine

Any ideas what's wrong ?


1 answer

0 votes

Hi @Jani Ruohomaa

Thank you for your question!

It's a great case for the custom pipe. We have cool and simple guides How to create a custom pipe as part of 12 days of CI/CD series.

Usage example for your custom pipe could be the next:

- step:
- pipe: docker://your-repository/your-custom_email-image:latest

Oleksandr Kyrdan

Also, we have open-sourced email-notify pipe,
so you could see how it build or use it just adding the next configuration to your pipeline:

  - pipe: atlassian/email-notify:0.4.3
      USERNAME: ''
      FROM: ''
      TO: ''
      HOST: ''

Oleksandr Kyrdan

Like Steffen Opel _Utoolity_ likes this

Thanks for the info, I have tried that email-notify pipe and it works fine but the problem I have is that I am running pmd and I want to send the result in the email body

I couldn't figure out how to expose the result to the email-notify so I decided to do the email sending from within the docker image also

Do you have any idea why the email sending does not work ? It works find if I log into the image and run the analysis and then send the result from my own laptop. In this case the host where the image is run is of course is different than in the pipeline

Does anyone have any luck sending mail from within a docker image ? I am running within the docker image pmd analysis, generating a html file and then sending the result with mail.

This all works fine on my own laptop but not in pipeline. The pmd analysis runs fine but not the mail sending. There are no errors. I tried putting on the debug levels for the mail command but it does not debug anything. When I run the mail command on my laptop within the docker image I get the debug statements.

It seems issuing that mail command within the docker image does not work at all, anyone have any experience with the same ?

Suggest an answer

Log in or Sign up to answer
Community showcase
Published in Bitbucket

⭐ Calling all Bitbucket and DevOps experts: Special showcase opportunity ⭐

Hi, Bitbucket community! Are you a DevOps practitioner (or know one in your network)? Do you have DevOps tips, tricks, or learnings you'd like to share with the community? If so, we'd love to hea...

1,481 views 4 7
Read article

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you