I setup some custom email notification at Post-function using Scriptrunner and even though the Outgoing Mail server is disabled, Scriptrunner is able to bypass that and still send emails.
I want to add a simple if statement and check if the Outgoing Mail server is Active or Disabled. Is there any way to do that using Scriptrunner?
Thank you!
I didn't try turning it on and off, but there's a system property called "jira.mail.send.disabled" and the fact that my instance sends mail and has it's value false makes me thing it is it.
To retrieve it you can use
import com.atlassian.jira.component.ComponentAccessor
ComponentAccessor.applicationProperties.getOption("jira.mail.send.disabled")
Well, I will be damned, it actually worked! I thank you so much for the answer. I was already running off in other direction, looking for other classes that would treat this system property differently.
What I am curious, if you can answer is: Where did you find this property?
Because in the documentation I found it was always
atlassian.mail.senddisabled
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I was just playing around with system properties once and found how to get their value. And for your case I just checked the System Info for something that contains "mail" because it sounded like a place to look for something like that :)
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Yep, thank you so much! I glanced over the System info properties and there's all sorts of goodies to use in a lot of use cases.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
It looks like this works for when you disable email in the Outgoing Mail with the button, but it doesn't work if email is disabled via startup flag (sigh)
Tested this on 8.5.1
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
If email is disabled via startup flag, reading the JVM Input Arguments works
import com.atlassian.jira.util.system.SystemInfoUtils
import com.atlassian.jira.util.system.SystemInfoUtilsImpl
SystemInfoUtils systemInfoUtils = new SystemInfoUtilsImpl()
String jvmArgs = systemInfoUtils.getJvmInputArguments()
isEmailDisabledStartup = false
if (jvmArgs.contains('-Datlassian.mail.senddisabled=true')) {
isEmailDisabledStartup = true
}
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hey
I know I'm late to the party, but your snippet here helped me out a ton. Thanks, @Martina Riedel
Best
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I found that I could use isSendingDisabled() from the Settings class. Apparently whenever I call this method it always states that the
atlassian.mail.senddisabled
always returns false...
Then if I go and make sure that the Outgoing Mail Server is really turned off but I try to Send a Test mail, it sends it without a hitch.
Could there be some other issue at play here :(?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.