Showing results for 
Search instead for 
Did you mean: 
Sign up Log in
It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

How do I add attachments to an e-mail with Automation for JIRA

Is it possible to add attachments to an e-mail with Automation for JIRA ?

5 answers

1 accepted

So you can't embed attachments directly in an e-mail (we don't support this due to the fact that attachments in JIRA could be far to large for emails), but you can add links using smart fields.

Here's an example rule:

Project automation - Code Barrel JIRA 2017-03-07 11-12-49.png

So this email body will iterate over all attachments on an issue and produce links that allow recipients to download the attachment directly from JIRA: 

Hi there,

<li><a href="{{content}}">{{filename}}</a></li>


Hello @andreas - can this code be adapted to add a comment (instead of an email) with links to all attachments?  Thanks!

Like # people like this

Hi @andreas. We want to send the attachments to an external support user, but the link would require a JSD account. Is there any way around this now? Thanks.

Like # people like this

Hi @andreas , really Automation for Jira has been great to work with. We are slowly learning how to optimize our JIRA instance. In light of this question, I am having trouble adding the attachment link to an email. The caveat is that Im using another plugin for creating additional attachment custom fields. 

Would you have a suggestion for how to deliver the link to the attachment in our custom field (customfield_17703). The reporter role would be the recipient of the email.

Any help would be greatly appreciated. 


Is there a way to do that with the Triggered Issue? I tried with this codes without luck any suggestions?

* [{{filename}}|{{content}}]

* [{{filename}}|{{content}}]

So far I could not find a way to overcome the limitations to send the attachments to the external support user purely using Jira tools. Even exposing them to the portal is a bit tricky, they need to be inside a comment.

I ended up fashioning a PHP script to expose a REST endpoint that would ingest destination email list, the email body and the attachment details then compose and send such emails from the corporate email servers. In automation instead sending the email I am sending a request to that endpoint. 

The PHP script itself logs in to Jira instance with an admin token hence it has access to all attachments it needs.

Like Javier_Corchado likes this

The alternative is to use an app like Notification Assistant for Jira which supports sending attachments up to 20 MB in size.


{{#issue.attachment}}<li><a href="{{content}}">{{filename}}</a></li>{{/issue.attachment}}

This code displays a list of all attachments, how to get only the file that is added now? for example, by the trigger for changing the attachment field - display a comment only with the attachment added.

{{#issue.attachment.last}}<li><a href="{{content}}">{{filename}}</a></li>{{/issue.attachment.last}}

Would this only pull down the only most recent file?

Yes, it returns the most recent array element.

David, when I use the .last it pulls the last attachment in the list rather than the most recently added to the list.  

Is there a way to get last by date?


Like Javier_Corchado likes this

Hi Matthew, when I used this, the attachments list (array) was populated internally chronologically, meaning the last one also was the most recent one. In case Atlassian has changed something there, you could also try '.first' instead of '.last'.

There is an ugly third possibility: If (like in the 'Approvers' array field) the order (index) of the attachments array elements keeps constantly changing, you would have to (only very quick summary) use the new automation feature (formerly Automation for Jira) to create a rule that

  • gets the total number of attachments (attachment.size)
  • iterates in a loop over each object id (attachment.get(0 to [whatever is attachment.size.minus(1)]) by creating fields in your issue that can be used as loop variables for
    • loop iteration
    • and array object index (this is tricky, because '.get(X)' requires a 'real' integer, and Jira number field data type is always floating point, so you'd need to e.g. use an auxiliary label field to be populated loop iteration by iteration with one additional element, then the 'auxiliary.size' property will return you a 'real' integer you can leverage for use in .get(x))
  • pull the 'attachment.get(x).created' properties for each element in attachments
  • save this somewhere together with the array index for a date comparison to decide what's newest (or in each loop iteration discard the previous iterated element when the current one is newer).

Hope that helps! 

Like Javier_Corchado likes this

For anyone else who comes across this... I had trouble with the code above, but this seemed to work for me: 

<a href="{{}}/{{issue.fields.attachment.filename}}">{{issue.fields.attachment.filename}}</a>

Hi, @Susan Ostreicher only administrator of Jira can access this link, so what about other users?


Use the lagacy automation. With the legacy automation you can also send the ticket description. In case the ticket description contains images etc, they are sent. 

Best regards


Hi Stephan,

what about comments with attachements?

Hi @AKSHAY THAKARE, I'm sorry for the slow reply. From what I can tell, anyone with permission to view the request (e.g. a reporter or a request participant) can access that link. Have you seen that's not the case? 

Yeah, but in my case, this is not happening only admin can access that link even reporter also not able to view that attachment.

Like mlucero likes this

Suggest an answer

Log in or Sign up to answer
Community showcase
Published in Apps & Integrations

Marketplace Partner Spotlight: Fine Software

Happy New Year, everybody! What better way to kick off 2022 than with a new Marketplace Partner Spotlight ✨ This month, we're getting to know Daniel Franz, co-founder of Fine Software. Fine Software ...

409 views 2 15
Read article

Community Events

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

Find an event

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

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you