Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

Basic setup of ScriptRunner Incoming Mail Handler

Matthew Frey
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
February 7, 2023

I'm using Jira Data Center and am trying to setup a Mail Handler with ScriptRunner.  My specific need is to allow the Mail Handler to process HTML files.

 

The problem I'm having is that when I click Run Now on the second page of the Mail Handler setup (same page where you enter the script), I get a message "Server Error An error occurred. Please review server logs".

I've setup the Mail Handler with the following settings.  I had more in the script but deleted most of it to try and get pas the Server Error message, but even one import line causes the error.:

I have an email.txt file in the /data/shira/sharedhome/import/mail folder.

(First Window)

Name: Test

Server: Local Files

Delay: 10

Handler: ScriptRunner Mail Handler

Folder Name: Blank

(Second Window)

Catch Email: <email address of the sender>

Forward Email: <my email address>

Strip Quotes: <unchecked>

Create Users: <unchecked>

Script:

import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.exception.CreateException
import com.atlassian.jira.service.util.ServiceUtils
import com.atlassian.jira.service.util.handler.MessageHandlerContext
import com.atlassian.jira.service.util.handler.MessageUserProcessor
import com.atlassian.jira.user.ApplicationUser
import com.atlassian.jira.user.util.UserManager
import com.atlassian.mail.MailUtils
import javax.mail.Message
import javax.mail.internet.InternetAddress
Question:  What is the easiest way to Setup a ScriptRunner mail handler and test that it is working?  If there are errors, which error log would the be in?  The script is not working, but I'm struggling to figure out how to debug with the the ScriptRunner Mail Handler environment.  Any help would be much appreciated.

1 answer

0 votes
Ram Kumar Aravindakshan _Adaptavist_
Community Champion
February 24, 2023

Hi @Matthew Frey

Could you please provide a screenshot of the error you are encountering?

I am asking for this to try and provide you with a better solution.

Thank you and Kind regards,

Ram

Suggest an answer

Log in or Sign up to answer