Hi,
I've added some post functions "Send a custom email" that are apparently working if I try to execute a preview but are not really working. Users tell me that they are not receiving emails.
I've added some lines of log and the log is correctly printed but no mails are sent.
How can I further debug the reasons of this problem?
thank you
So, JIRA keeps a separate log for the mail handler. Look for atlassian-jira-outgoing-mail.log in your JIRA home. If JIRA's having trouble sending out the messages for some reason, the errors will likely be in there.
Your log statements may not show up in your logs unless you use log.warn or log.error. Alternately, you can crank up the logging level for the ScriptRunner packages by running the script below in the Script Console.
import org.apache.log4j.Level import org.apache.log4j.Logger Logger.getLogger("com.onresolve.jira.groovy").setLevel(Level.DEBUG)
Those logs will show up in the normal atlassian-jira.log file.
Hi @Jonny Carter [Adaptavist],
I've enabled to DEBUG log directly in the post function "Send Custom Email" in order to print:
I've also enabled the outgoing-email-log
The problem is that:
Should I have to update to the last version of script runner? We currently have version 4.1.3.11 and I see that there is version 4.1.3.22 available for download.
Thank you again for your support
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
There was a small change in 4.1.3.22 that made it a bit easier to pick users for scripts like Send Custom Email. I'd be surprised if that resolved your issue–if anything, it sounds like there may be something amiss with your mail server configuration–but it's definitely worth a shot.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Also, I'd be curious what else might have changed in your JIRA instance in the past few weeks. If your notification script didn't change, is there anything else that could have caused the issue?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Unfortunately nothing changed and, in addition to this, all other standard notifications from JIRA still work.
Any idea about how to log this behaviour?
Should I have to upgrade Script Runner version?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Do you see any warnings in your logs like with the text "Error sending email" or "No mail server or sending disabled."? Those warnings would happen if sending were disabled for some reason, or there were some trouble adding an item to the mail queue. You might also check your mail queue. Could be the messages are getting stuck there for some reason?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
No warnings like that ones in atlassian-jira.log file and no mails in the queue.
What is strange is also that some emails are sent (related to specific workflow transitions) and some others, on transitions of the same workflow, are no longer sent.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
That sounds suspiciously like you have a condition on the post function that's causing them not to send. It would also account for the successful execution history, even though no emails go out. What condition clause are you using on the workflow steps that are failing, compared to what you're using where you're successfully getting email?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I've added logs in the conditions scripts with the result of the evaluated conditions and the result is true.
An example is:
2016-12-02 15:24:41,451 Thread-2064 DEBUG XXXX [...] [Workflow Outgoing Emails Log] Transition 'Approve'(201): Issue => XX-265 2016-12-02 15:24:41,452 Thread-2064 DEBUG XXXX [...] [Workflow Outgoing Emails Log] Transition 'Approve'(201): user1.toString() => x.y 2016-12-02 15:24:41,452 Thread-2064 DEBUG XXXX [...] [Workflow Outgoing Emails Log] Transition 'Approve'(201): user2.toString() => z.w 2016-12-02 15:24:41,453 Thread-2064 DEBUG XXXX [...] [Workflow Outgoing Emails Log] Transition 'Approve'(201): Evaluated condition => true 2016-12-02 15:24:41,453 Thread-2064 DEBUG XXXX [...] [Workflow Outgoing Emails Log] Transition 'Approve'(201): To => z.w:10000 2016-12-02 15:24:41,453 Thread-2064 DEBUG XXXX [...] [Workflow Outgoing Emails Log] Transition 'Approve'(201): CC => email1@XX.com
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
@Jonny Carter [Adaptavist]: if it can be useful, it seems that the notifications that are no longer working are those for which both "" and "" are filled in in the post function configuration.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
@Arianna Fabbri - If you remove one of those CC fields (either the CC addresses or the CC issue fields), do the notifications go out? If not, that's probably a red herring; those fields should work together normally.
I'm assuming the above log sample from a mail that successfully went out, right? Not a failed one?
Something that might help is to crank up the debug logging for ScriptRunner itself and see if you can find some messages from the SendCustomEmail function itself.
import org.apache.log4j.Level import org.apache.log4j.Logger Logger.getLogger("com.onresolve.jira.groovy").setLevel(Level.DEBUG)
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
The "Send custom email" post function has to be added before or after the issue reindex? Is this important or not?
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.