I'm trying to see if I can use Scriptrunner to block Jira Filter Subscription emails system-wide from going out on a Government system (don't ask why). These emails have the word "Subscription" in the Subject, so a way to block any email with "Subscription" in the subject would be the goal. A Listener will not be triggered by a Subscription, so I can't use that. Any other ideas?
Hi @Kathy Dickason,
To block Jira Filter Subscription emails based on the Summary, you need to go below the event layer and access the Mail Queue directly. Consider intercepting the MailQueue and removing items that meet your criteria before they are sent to the SMTP server.
Running a ScriptRunner Scheduled Job script using a ComponentAccessor each time to "scrub" the queue could be a solution. It requires the job to run frequently to catch emails before the standard Mail Queue flush, which happens every 1 minute by default. You might even consider flushing only every 3-5 minutes to minimize the risk.
The better way: you can use off-server logic and configure your mail server to act as a content filter, dropping any outgoing mail that contains the "Subscription" header. This approach ensures that even if an email slips through due to timing issues or a ScriptRunner error, the message is caught and discarded at the transport layer before reaching an inbox.
Hello @Kathy Dickason
Filter subscription mails are not normal issue events. They are generated by Jira’s scheduled subscription/mail queue processing, and in the logs they show up as com.atlassian.jira.mail.Subscription. That is why your Listener approach does not really have anything reliable to hook into here. ScriptRunner listeners are event-driven, so this is the wrong layer for that job.
I would do that at the SMTP relay / mail gateway, not inside Jira. That is much cleaner than trying to intercept Jira’s own outbound queue mid-flight. The Jira-side mail queue is shared with other notifications, so filtering there is not very surgical.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.