How to update all mail handlers to associate with the incoming mail server

Still need help?

The Atlassian Community is here for you.

Ask the community

Platform notice: Server and Data Center only. This article only applies to Atlassian products on the Server and Data Center platforms.

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

Always back up your data before performing any modifications to the database. If possible, test any alter, insert, update, or delete SQL commands on a staging server first.

The incoming mail server protocol (POP/IMAP) are stored in the propertystring table. To update the mail handler to use the new incoming mail server, please follow the steps below:

(warning) We strongly recommend backing up Jira's database before proceeding.

(info) The database queries below were designed for PostgreSQL and might need to be tweaked to work in other database systems. They were also only tested in Jira 7.6.x.

  1. Search for the mail handlers and their associated mail servers in Jira's properties stored on the database:

    SELECT sc.id AS "Handler ID", sc.servicename AS "Handler Name", ms.id AS "Mail Server ID", ms.servername AS "Mail Server Name", ps.id AS "propertystring ID"
    FROM serviceconfig sc 
    	INNER JOIN propertyentry pe ON pe.property_key = 'popserver' AND pe.entity_id = sc.id
    	INNER JOIN propertystring ps ON ps.id = pe.id
    	INNER JOIN mailserver ms ON CAST(ps.propertyvalue AS integer) = ms.id
    WHERE sc.clazz = 'com.atlassian.jira.service.services.mail.MailFetcherService';
  2. Take note of the IDs for the mail handlers you'd like to switch to a different server and their matching IDs for the 'propertystring' table;

  3. Get the ID of the new mail server (the first column returned by the below query):

    SELECT * FROM mailserver;
  4. Shutdown Jira;
  5. Update the properties for the mail handlers you'd like to switch (as noted on step 2) to match the ID of the new mail server:

    UPDATE propertystring SET propertyvalue = '<new-id>' WHERE id = <propertystring-id>;
  6. Restart Jira;

If you use Jira Service Management

The mail server configuration in Service Management is executed per project and not shared, so if you need to update that you'll have to go through each project. You can list all of the email channels configured for Service Management under Administration > Applications > Email requests.

Last modified on Apr 26, 2021

Was this helpful?

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