Using Gmail as a Crowd Mail Server

Platform Notice: Data Center Only - This article only applies to Atlassian products on the Data Center platform.

Note that this KB was created for the Data Center version of the product. Data Center KBs for non-Data-Center-specific features may also work for Server versions of the product, however they have not been tested. Support for Server* products ended on February 15th 2024. If you are running a Server product, you can visit the Atlassian Server end of support announcement to review your migration options.

*Except Fisheye and Crucible

Summary

This page describes using Gmail for an outgoing mail server. It requires importing Gmail's SSL certificate.

Solution

Configuring GMail for Outgoing Mail (SMTP)

  1. Download OpenSSL:

    Linux: http://www.openssl.org/

    Windows: http://gnuwin32.sourceforge.net/packages/openssl.htm

  2. Import the SSL certificate from Gmail:

    Windows: Double-click the openssl file from the directory that gets installed. Run:

    1 s_client \-connect smtp.gmail.com:465

    Linux: Run:

    1 openssl s_client \-connect smtp.gmail.com:465
  3. From the output, you want only the alphanumeric string between the lines which say 'BEGIN CERTIFICATE' and 'END CERTIFICATE' (inclusive). Copy the results into a file called gmail.cert using your favorite text editor.

  4. Exit the openssl prompt, and return to your Java installation's bin directory. Import the cert into your keystore:

    From Sun´s Documentation on Keytool:

    A keystore is created whenever you use a -genkey, -import, or -identitydb command to add data to a keystore that doesn't yet exist. More specifically, if you specify, in the -keystore option, a keystore that doesn't yet exist, that keystore will be created. If you don't specify a -keystore option, the default keystore is a file named .keystore in your home directory. If that file does not yet exist, it will be created."

    Windows:

    1 keytool \-import \-alias smtp.gmail.com \-keystore $JAVA_HOME/jre/lib/security/cacerts \-file C:\path\to\gmail.cert

    Linux:

    1 sudo keytool \-import \-alias smtp.gmail.com \-keystore $JAVA_HOME/jre/lib/security/cacerts \-file /path/to/gmail.cert

    The default keystore password is 'changeit'.

  5. Configure the JNDI Resource as described on Configuring your Mail Server

If you receive an error using the port 465 please give it a try using the port 587.

To avoid spamming some network providers are not allowing standard ports to send mail.

Updated on April 8, 2025

Still need help?

The Atlassian Community is here for you.