Configuring Bamboo to send SMTP Email

On this page

Still need help?

The Atlassian Community is here for you.

Ask the community

Bamboo can send email notifications about its build results. There are two steps to setting this up:

  1. Configure Bamboo to send SMTP email (see below).
  2. Configure a plan to send SMTP email notifications about build results (see Configuring notifications for a plan and its jobs).

Configuring Bamboo to send SMTP email

To configure Bamboo to send SMTP email:

  1. Click the  icon in the Bamboo header and choose Overview.
  2. Click Mail Server in the left navigation column (under 'Communication'). This will display the 'Mail Server Details' page (see screenshot below).
  3. Edit the mail server settings as necessary:

    Name
    A display-name for the email address e.g. 'SMTP Server'

    From Address
    The email address from which Bamboo notifications will be sent.

    Subject Prefix
    The text (if any) which will be added to the start of the email subject line. For example '[Bamboo]' will result in emails with subjects like:

    • [Bamboo] TEST build 1,001 has FAILED (77 tests failed, no failures were new) : Change made by jsmith
    • [Bamboo] TEST build 1,002 was SUCCESSFUL (with 77 tests) : Change made by jsmith

     
    Email Settings
    Choose either SMTP or JNDI. See the Notes about JNDI below.

    SMTP Server
    The address of the email server that Bamboo will use to send notifications e.g. 'mail.myserver.com'.

    Username
    The login name of the account that Bamboo will use to login to the SMTP server.

    JNDI Location
    Depends on your application server, and on the location of the 'mail' resource within the JNDI tree you specify. E.g. 'java:comp/env/mail/BambooMailServer'.

  4. Type a test email address in the Test Recipient Address box.
  5. Click Test, and verify that a test email is received.
  6. Click Save.

Screenshot: Email Server Details


Configuring email notifications for Gmail

Gmail.com uses TLS (SSL). A JNDI connector needs to be configured. Unfortunately Bamboo does not yet support JNDI with TLS.

To enable Gmail as your mail server:

  1. Install Bamboo.
  2. Make sure that the following files are copied to and  exists only in <Bamboo-Install> /lib:
    • javax.mail-X.X.X.jar
    • javax.mail-api-X.X.X.jar (only if you're using Bamboo 6.0 or later)

       

      • If the javax.mail-X.X.X.jar and javax.mail-api-X.X.X.jar files don't exist in the <Bamboo-Install> /lib directory, you must move the javax files installed at  <Bamboo-Install>/atlassian-bamboo/WEB-INF/lib  to <Bamboo-Install> /lib.
      • If the javax.mail-X.X.X.jar and javax.mail-api-X.X.X.jar files already exists in the <Bamboo-Install> /lib directory, simply delete the javax files shipped with Bamboo in  <Bamboo-Install>/atlassian-bamboo/WEB-INF/lib .


        In Bamboo 5.9 the mail-X.X.jar and activation-X.X.jar files were included in the download archive. Starting with Bamboo 5.10:

        • the mail-X.X.jar file has been renamed to javax.mail-X.X.X.jar and must be moved to <Bamboo-Install> /lib
        • the activation.jar file is not required
  3. Add the following configuration to your BambooInstall/conf/server.xml file:

    <Context path="/bamboo" docBase="${catalina.base}/atlassian-bamboo" reloadable="true">
              <Resource name="mail/GmailSmtpServer"
                auth="Container"
                type="javax.mail.Session"
                mail.smtp.host="smtp.gmail.com"
                mail.smtp.port="465"
                mail.smtp.auth="true"
                mail.smtp.user="<your-name>@gmail.com"
                password="<your-pw>"
                mail.smtp.starttls.enable="true"
                mail.smtp.socketFactory.class="javax.net.ssl.SSLSocketFactory"
              />
    </Context>
    


Configure Bamboo to use a JNDI Location of  java:comp/env/mail/GmailSmtpServer. Note that the JNDI Location is case sensitive and must match the resource name specified in server.xml.

Notes

You can use a mail session as an alternative to specifying mail details directly in Bamboo. You configure the mail session in your application server (e.g. in the server.xml file — see Locating important directories and files), and then use JNDI to look up the preconfigured mail session. JNDI has the following advantages:

    • Centralized management - mail details are configured in the same place as database details, and may be configured through your application server administration tools.
    • Better security - mail details are not available to Bamboo administrators through the Bamboo interface, and aren't stored in Bamboo backup files.
    • More SMTP options - e.g. SSL. If you want to use SMTP over SSL you will need to use JNDI.
Last modified on Oct 19, 2018

Was this helpful?

Yes
No
Provide feedback about this article
Powered by Confluence and Scroll Viewport.