Is it possible to add attachments to JJupin - SIL custom email (using sendHtmlEmail)?

I see that it is possible with a text email but can not attach to HTML email.

Also, to take this even further; Is it possible to display a screenshot (embedded image) in an HTML email via JJupin-SIL script?

2 answers

1 accepted

This widget could not be displayed.

Sure, you can send an email with an attachment like this:

sendHtmlEmail("person@email", "person@email", cc, "Email with Attachment", "This is an HTML email", "", "/tmp/jira/attachments/image.jpg");

Or, assuming you are on Linux, and with some work, you could do something like this to embed the image in the email:

system("/bin/bash /home/jira/ /tmp/jira/attachments/image.jpg");
string fileContent = readFromTextFile("/tmp/jira/base64.txt");
sendHtmlEmail("person@email", "person@email", cc, "Email with Attachment", "This is an HTML email <img width=\"413\" height=\"500\" src=\"data:image/jpeg;base64," + fileContent + "\" />", "", "/tmp/jira/attachments/image.jpg");

This uses a little script:

test=$( base64 $1)
echo $test > /tmp/jira/base64.txt

You would want a stronger naming convention on the txt file...

I used the script to output the base64 encoded image to a txt file because there is a 4kb limit on the amount of data that can be returned by the system function in SIL. The readFromTextFile command does not seem to have a limit.

You would also need to do some work to get the file type (jpeg, png, etc) if you were using this in a dynamic way. Image magic has some command line functions that could be used to obtain this information.

Thanks for your answer Jon!!!



Nice, I had been looking for this solution for a while. Thanks a lot

This widget could not be displayed.

It's really helpfull but what if I would like to make my life easier and send an image smaller than 4kb? (I generated base64 from my image using online tools). How can I attach it in a easy way to my email?

Suggest an answer

Log in or Sign up to answer
Atlassian Summit 2018

Meet the community IRL

Atlassian Summit is an excellent opportunity for in-person support, training, and networking.

Learn more
Community showcase
Posted Wednesday in New to Jira

Are you planning to trial, or are currently trialling Jira Software? - We want to talk to you!

Hello! I'm Rayen, a product manager at Atlassian. My team and I are working hard to improve the trial experience for Jira Software Cloud. We are interested in   talking to 20 people planning t...

155 views 2 0
Join discussion

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you