Setting Up a Mail Session for the Confluence Distribution
The simplest way to set up a mail server is through the Confluence Administration console. See Configuring a Server for Outgoing Mail.
If you want to add different options or parameters you can also set up a mail session for the Confluence distribution. In the example below we'll set up Gmail.
To set up a mail session for the Confluence distribution:
- Stop Confluence.
Move (don't copy) the following files from
<confluence-install>\confluence\WEB-INF\lib
to<confluence-install>\lib:
com.sun.activation_jakarta.activation-x.x.x.jar
com.sun.mail_jakarta.mail-x.x.x.jar(x.x.x. represents the version numbers on the jar files in your installation)
Don't 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.Edit the
<confluence-install>\conf\server.xml
file and add the following at the end of the Confluence <context> tag, just before</Context>
.
Note: you're editing the <context> tag that contains the Confluence context path, not the one that contains the Synchrony context path.<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="yourEmailAddress@gmail.com" password="yourPassword" mail.smtp.starttls.enable="true" mail.transport.protocol="smtps" mail.smtp.socketFactory.class="javax.net.ssl.SSLSocketFactory" />
- Restart Confluence.
Go to Administration menu , then General Configuration > Mail Servers.
- Select either Edit an existing configuration, or Add a new SMTP mail server.
Edit the server settings as necessary, and set the JNDI Location as:
java:comp/env/mail/GmailSMTPServer
Note that the JNDI Location is case sensitive and must match the resource name specified in server.xml.- Save your changes and send a test email.