How do I configure Confluence to use Gmail as the mail server?

Still need help?

The Atlassian Community is here for you.

Ask the community

tip/resting Created with Sketch.

Remember to generate and use an application specific password if Google's two-factor authentication is enabled.


To configure Confluence to use Gmail as the mail server.


Confluence 5.6 and above

For Confluence 5.6 and above, you can set up Gmail through the admin console

  1. Go to Admin > Mail Servers
  2. Click 'Add a new SMTP mail server'
  3. Fill out your mail account details. 
  4. Enter for the mail server and 587 for the port, and ensure you tick Use TLS:

Confluence 5.5.x and below

For Confluence 5.5.x and below, you will need to create a JNDI mail session and then have Confluence use it, as described below.

To do this for the Confluence distribution, please see Setting Up a Mail Session for the Confluence Distribution.

  1. Stop Confluence.
  2. Move (don't copy) activation-1.0.2.jar (if it exists) and mail-1.4.1.jar from /confluence/WEB-INF/lib to <Confluence Standalone install>/lib. Or if you are using Confluence WAR release, move to <Tomcat 5 install>/common/lib or <Tomcat 6 install>/lib.

    The exact version numbers on these jar files may vary, but that should not matter. As of Confluence 5.2.3, activation-1.0.2.jar no longer exists, and does not need to be moved or downloaded

    Do not leave a renamed backup of the jar files in /confluence/WEB-INF/lib. Even with a different file name, the files will still be loaded as long as it remains in the directory.

  3. Add the following Resource tag in confluence.xml or server.xml located at <confluence-install>/conf, inside the <Context> node (substituting username and password), so it looks like this:

    // The context tag here is for illustrative purposes only, to highlight where the Resource tag should be entered. You do not need to copy the Context tag, it will already exist in your file.
    <Context path="/confluence" docBase="../confluence" debug="0" reloadable="false" useHttpOnly="true">
        <!-- Logger is deprecated in Tomcat 5.5. Logging configuration for Confluence is specified in confluence/WEB-INF/classes/ -->
        <Manager pathname="" />
    	// Copy this Resource tag into the Context tag in your server.xml, and enter your user and password details
        <Resource name="mail/Session"
    	// End section to copy
  4. Restart your Confluence instance.
  5. Add java:comp/env/mail/Session to your JNDI mail configuration from Administration > Mail Servers.


  • You may optionally add mail.debug="true" into the <Resource> to see logs generated by JavaMail.
  • If your Google account uses 2-step verification you will need to use an application password instead of your password.
  • Also, if you find connection errors using the port 465 please change it to 587.

Last modified on Aug 13, 2020

Was this helpful?

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