Hello,
is it possible to remove the email footer or signature within a script runner mailhandler? If so, how would you achieve this feature?
Yours Christoph
Hi @[deleted]
I tried the same with the email history and wanted to cut that off. However, this is had to be done by some string processing and looking for keywords like "From: " and it is not the best working solution. But if the footer and signature is always looking similar you can try to search the mail body for keywords and cut it off.
What I also did was to remove the small icons from the signatures (<5kb) from the issues attachments. Usually you only want to have real attachments form an email in the issue and not those small icons. I did that by removing them directly from the issue in the mail handler script.
Hi @Jonas Moehringer - ij-solutions ,
have you got some code snippets? I have no idea how to remove such things. Lookd up some RegEx but have also not a real idea of how this might works.
Thanks
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi @[deleted]
sure, here is an example of how the remove everything from the body starting from string "From: ":
if(body.toString().indexOf("From: ")!=-1){
if(body.toString().indexOf("From: ")!=0){
body = body.toString().substring(0, body.toString().indexOf("From: "))
}
}
It also considers that "From: " can't be at the beginning of the body because then nothing would be left of the body.
Afterwards, this body can be set as description. I am not an expert with regEx but there might be some nice solutions with regEx as well to cover more different email contents.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hello @Jonas Moehringer - ij-solutions
thanks for your example. I've already implemented another workaround where I used the split() method to cut the mail in 2 parts and only used the first one in my description.
issueObject.setDescription(MailUtils.getBody(message).split("codeword")[0])
Since our signature is static this works out for me.
Just one more question, do you have any idea / solution how to add the mail also to the attachment section of an issue so people can watch the original mail or store it?
Thanks in advance
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi @[deleted]
ok, if your signature is always the same or similar you can use the split approach as well.
Regarding your question I can say that we had such requests from users as well but I didn't find any solution to implement something like that. Maybe you can write the email contents to a file on the server and then attach it to the issue, but I never did something like that. We just told our users that this is not possible ;)
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.
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.