Documentation for JIRA 4.4. Documentation for other versions of JIRA is available too.

Skip to end of metadata
Go to start of metadata

To enable JIRA to send notifications about various events, you need to first configure JIRA to send SMTP email.

1. Define the SMTP Mail Server

  1. Log in as a user with the 'JIRA System Administrators' global permission.
  2. Select 'Administration' > 'System' > 'Mail' > 'Mail Servers'.
    (tick) Keyboard shortcut: 'g' + 'g' + type 'ma'
  3. Click "Configure new SMTP mail server".
  4. This will display the "Add SMTP Mail Server" screen. Complete the top section as follows:

    Name

    An arbitrary name to associate with this email server configuration.

    Description

    (Optional) Email server description.

    From address

    The email address that outgoing mails will appear to have come from (unless overridden per project).
    Note that this is just the address part ("jira@company.com"). JIRA will use it in constructing the full From header based on the current user ("Joe Bloggs (JIRA) <jira@company.com>").
    To change the From header, go to the "Administration" menu, select "General Configuration" (under "Global Settings") and edit the Email From Header field.

    Email prefix

    The subject of emails sent from this server will use this string as a prefix. This is useful for your users so that they can filter their email.

Screenshot: Add SMTP Mail Server

On this page:

(warning) The information on this page does not apply to JIRA OnDemand.

2. Specify the Host Name or JNDI Location

The 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 Name of your mail server;
    or:
  • specify the JNDI Location— that is, use JNDI to look up a mail server that you have preconfigured in your application server. This has the following advantages:
    • Better security: the mail details are not available to JIRA administrators through the JIRA administration interface, and are not stored in JIRA backup files.
    • More SMTP options: for instance, you could switch to RSET instead of NOOP for testing connections by setting the mail.smtp.userset property.
    • Centralised management: mail details are configured in the same place as database details, and may be configured through your application server administration tools.

Specify the Host Name

Most people configure SMTP details directly in JIRA. The form fields are as follows:

Host Name

Hostname or IP address of your SMTP server. Eg. mail.yourcompany.com

SMTP Port

The SMTP port, usually 25.

Timeout

The timeout period in milliseconds, defaults to 10000.

TLS

Select this check-box if your SMTP host uses the Transport Layer Security protocol.

Username

Username to connect as, if your SMTP host requires authentication. (Most company servers require authentication to relay mail to non-local users.)

Password

Password for username (if required by your SMTP host).

Icon

If your server's startup script uses the "-Dmail" system properties (e.g. "mail.smtp.host" or "mail.smtp.port" ), they will override the settings that you specify in the above form. Additionally, if necessary you can manually specify the host name that JIRA reports itself as to the SMTP server by setting -Dmail.smtp.localhost

Once done, click 'Update' and then "Send a Test Email" to test the connection details.

Specify and configure a JNDI Location

As 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:

JNDI Location

The JNDI location of a javax.mail.MailSession object to use when sending email. This will begin with the prefix java:comp/env/.

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:

Or if you don't require authentication (e.g. if you are sending via localhost, or only internally within the company):

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 Classes

You 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:

or:

Lighter app servers — Tomcat (including JIRA Standalone) — do not always come with JavaMail.

To prevent any conflicts, check your application server's lib/ directory:

  • If the application server already contains mail-1.4.1.jar and activation-1.1.1.jar, then just remove WEB-INF/lib/mail-1.4.1.jar and WEB-INF/lib/activation-1.1.1.jar from the JIRA webapp.
  • If the application server does not contain mail-1.4.1.jar and activation-1.1.1.jar, then move JIRA's WEB-INF/lib/mail-1.4.1.jar and WEB-INF/lib/activation-1.1.1.jar into the application server's lib/ directory.

SMTP over SSL

You 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.

Icon

Important note: Without importing the certificate, JIRA will not be able to communicate with your mail server.

Secondly, edit your mail server connection properties and specify starttls and SSLSocketFactory. From {$JIRA_INSTALL}/conf/server.xml (this example uses Gmail's server):

Troubleshooting

A 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

  • If JIRA doesn't appear to be creating or sending emails or creating issues and comments from email, your JIRA instance could be experiencing OutOfMemory errors. Please check your log files for OutOfMemory errors. If there are OutOfMemory errors, please restart JIRA and investigate the errors.
  • If you find some incoming emails simply disappear, check that you haven't accidentally started a second copy of JIRA (eg. in a staging environment) which is downloading and deleting mails. See the Restoring Data page for flags you should set to prevent mail being processed.
  • If you receive 'Mail Relay' errors, make sure you have specified the Username and Password in the 'SMTP Host' section of the configuration screen.

Getting Help

If you cannot resolve a problem yourself, please create a support case in the 'JIRA' project and we will assist.