Hi Team,
We are currently investigating why the email body of an external sender did not appear in the incoming email handler tickets. Attached is a screenshot of the email body. The ticket description only includes the message: "[Created via e-mail received from Microsoft Azure <azure-noreply@microsoft.com>]". Our account's sent emails are successfully adding the email body to the tickets. We suspect that there may be an issue with the email body's formatting.
Could you please suggest us?
Hi @Lakshmi CH,
Your issue looks similar to this: https://confluence.atlassian.com/jirakb/jira-created-issue-from-e-mail-has-no-description-744526382.html
As for this:
Our account's sent emails are successfully adding the email body to the tickets. We suspect that there may be an issue with the email body's formatting.
Do these emails have the same body as Microsoft Azure's emails do? Can you try to forward Microsoft Azure's emails from your mailbox and check if the created ticket has the correct Description?
Hi @Lakshmi CH
Could you please share the mail handler configuration that you are currently using? I am requesting for this so I can review it and provide some feedback and suggest a better solution.
Thank you and Kind regards,
Ram
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.
Hi @Lakshmi CH ,
This is your outgoing mail configuration.
This is not what I requested.
I need to see your mail handler configuration and code.
Thank you and Kind regards,
Ram
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Sorry @Ram Kumar Aravindakshan _Adaptavist_, Where should I check this mail handler configuration and code?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi @Ram Kumar Aravindakshan _Adaptavist_ -- Lakshmi provided the incoming mail configuration and mail handler, but perhaps you are looking for more details of the handler config? If this isn't what you are looking for please describe where to gather it.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi @Susan Sako / @Lakshmi CH
Thank you for getting back and providing the screenshots.
From the latest screenshots you shared, this doesn't appear to be ScriptRunner's Mail Handler.
You are instead using the Create a new issue from each email handler.
If you want to include the message body via ScriptRunner's Mail Handler, you will need to change your mail handler configuration to:-
Once you have selected ScriptRunner's Mail Handler, you will need to add some conditions to the code like the example below:-
import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.config.util.JiraHome
import com.atlassian.jira.event.type.EventDispatchOption
import com.atlassian.jira.issue.MutableIssue
import com.atlassian.jira.service.services.file.FileService
import com.atlassian.jira.service.util.ServiceUtils
import com.atlassian.jira.service.util.handler.MessageUserProcessor
import com.atlassian.mail.MailUtils
import org.apache.commons.io.FileUtils
def userManager = ComponentAccessor.userManager
def projectManager = ComponentAccessor.projectManager
def issueManager = ComponentAccessor.issueManager
def issueFactory = ComponentAccessor.issueFactory
def commentManager = ComponentAccessor.commentManager
def messageUserProcessor = ComponentAccessor.getComponent(MessageUserProcessor)
def jiraHome = ComponentAccessor.getComponent(JiraHome)
def subject = message.subject as String
def issue = ServiceUtils.findIssueObjectInString(subject) as MutableIssue
if (issue) {
return
}
def user = userManager.getUserByName('admin')
def reporter1 = messageUserProcessor.getAuthorFromSender(message) ?: user
def project = projectManager.getProjectObjByKey('MOCK')
def issueObject = issueFactory.issue
issueObject.setProjectObject(project)
issueObject.setSummary(subject)
issueObject.setDescription(MailUtils.getBody(message))
issueObject.setIssueTypeId(project.issueTypes.find { it.name == 'Bug' }.id)
issueObject.setReporter(reporter1)
issue = messageHandlerContext.createIssue(user, issueObject) as MutableIssue
def attachments = MailUtils.getAttachments(message)
def issueDescription = new StringBuilder(issue.description).append('\n')
def destination = new File(jiraHome.home, FileService.MAIL_DIR).canonicalFile
attachments.each {
def file = FileUtils.getFile(it.filename) as File
messageHandlerContext.createAttachment(file, it.filename, it.contentType, user, issue)
}
FileUtils.forceDelete(destination.listFiles().first())
issue.setDescription(issueDescription.toString())
commentManager.create(issue, user, 'This is a sample', true)
issueManager.updateIssue(user, issue, EventDispatchOption.DO_NOT_DISPATCH,false)
Please note that the working sample code above is not 100% exact to your environment. Hence, you will need to modify it accordingly.
I hope this helps to solve your question. :-)
Thank you and Kind regards,
Ram
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi @Lakshmi CH / @Susan Sako
Has your question been answered?
If yes, please accept the answer.
Thank you and Kind regards,
Ram
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi @Ram Kumar Aravindakshan _Adaptavist_ ,
I don't want to try the process as it is not a straightforward solution for all users; it only works who have that addon. There seems to be an issue with the formatting that arises from Microsoft Azure.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi @Lakshmi CH
Thanks for getting back.
I have removed the ScriptRunner tag from this question as it is pretty misleading, which is the main reason I provided that solution is because I assumed you were using ScriptRunner.
Thank you and Kind regards,
Ram
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.