JIRA 4.3 : Configuring JIRA to Send SMTP Mail
This page last changed on Mar 10, 2011 by ggaskell.
To enable JIRA to send notifications about various events, you need to first configure JIRA to send SMTP email. On this page: 1. Define the SMTP Mail Server
Screenshot: Add SMTP Mail Server 2. Specify the Host Name or JNDI LocationThe second part of the screen specifies the Server Details of the SMTP server to which JIRA will send mail. There are two ways you can do this. Either:
Specify the Host NameMost people configure SMTP details directly in JIRA. The form fields are as follows:
Once done, click 'Update' and then "Send a Test Email" to test the connection details. Specify and configure a JNDI LocationAs an alternative to specifying mail details directly in JIRA, you can configure them in your application server, and then look up a preconfigured mail session via JNDI. On the 'Add SMTP Mail Server' screen (see above), complete the following form field:
The JNDI Location will depend on your application server and configuration. For example, in Tomcat 6 (the default application server that is bundled with JIRA Standalone ), your JNDI Location would be java:comp/env/mail/JiraMailServer, and you would add the following section in conf/server.xml , inside the <Context> node: <Context path="" docBase="${catalina.home}/atlassian-jira" reloadable="false"> .... <Resource name="mail/JiraMailServer" auth="Container" type="javax.mail.Session" mail.smtp.host="mail.yourcompany.com" mail.smtp.port="25" mail.transport.protocol="smtp" mail.smtp.auth="true" mail.smtp.user="jirauser" password="mypassword" /> </Context> Or if you don't require authentication (e.g. if you are sending via localhost, or only internally within the company): <Context path="" docBase="${catalina.home}/atlassian-jira" reloadable="false"> .... <Resource name="mail/JiraMailServer" auth="Container" type="javax.mail.Session" mail.smtp.host="localhost" mail.smtp.port="25" mail.transport.protocol="smtp" /> </Context> The format for other application servers will be similar. For details please see the Transaction Factory documentation. If you have problems connecting, add a mail.debug="true" parameter, which will let you see SMTP-level details when testing the connection. Move the JavaMail ClassesYou will also need to ensure that the JavaMail classes are present in your application server's classpath, and do not conflict with JIRA's copy. This is necessary because the application server is establishing the SMTP connection, not JIRA, and the application server will not see the JARs in JIRA's classloader. Some operating systems may ship the JavaMail classes with application servers (eg. Tomcat in Red Hat Enterprise Linux). This may conflict with JIRA's copy of the JavaMail classes, resulting in errors like: java.lang.NoClassDefFoundError: javax/mail/Authenticator or: java.lang.IllegalArgumentException: Mail server at location [java:comp/env/mail/JiraMailServer] is not of required type javax.mail.Session. Lighter app servers — Tomcat (including JIRA Standalone) — do not always come with JavaMail. To prevent any conflicts, check your application server's lib/ directory:
SMTP over SSLYou can encrypt email communications between JIRA and your mail server via SSL, provided your mail server supports SSL. Firstly, you will need to import the SMTP server certificate into a Java keystore. The process is described on the Connecting to SSL Services page.
Secondly, edit your mail server connection properties and specify starttls and SSLSocketFactory. From {$JIRA_INSTALL}/conf/server.xml (this example uses Gmail's server): <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="myusername@gmail.com" password="mypassword" mail.smtp.starttls.enable="true" mail.smtp.socketFactory.class="javax.net.ssl.SSLSocketFactory" /> TroubleshootingA useful tip for debugging mail-related problems in JIRA is to set the -Dmail.debug=true property on startup. This will cause protocol-level details of JIRA's email interactions to be logged. Additionally, turning up JIRA's log level will show when the service is running and how mails are processed. Common Problems
Getting HelpIf you cannot resolve a problem yourself, please create a support case in the 'JIRA' project and we will assist. ![]() ![]() ![]() ![]() ![]() |
![]() |
Document generated by Confluence on Mar 27, 2011 18:34 |