How to update all mail handlers to associate with the incoming mail server
Platform notice: Server and Data Center only. This article only applies to Atlassian products on the server and data center platforms.
Alwaysyour 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:
We strongly recommend backing up Jira's database before proceeding.
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.
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';
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;
Get the ID of the new mail server (the first column returned by the below query):
SELECT * FROM mailserver;
- Shutdown Jira;
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>;
- 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.