---
title: "attachAllFilesFromEmail"
canonical: "https://support.appfire.com/space/PSJ/15480772/attachAllFilesFromEmail"
format: markdown
---
> Macro (aura-html)


> 📝 The use of this function requires the Power Scripts for Jira add-on be installed and licensed.

|  |  |  |  |
| --- | --- | --- | --- |
| **Syntax** | attachAllFilesFromEmail(issueKey) | **Package** |  |
| **Alias** |  | **Pkg Usage** |  |

## Description

> Macro (excerpt)
> 
> Attaches all attachments from the incoming email to a specific issue.

Attaches all attachments from the incoming email to a specific issue.

## Parameters

| Parameter name | Type | Required | Description |
| --- | --- | --- | --- |
| issueKey | string | Yes | The issue to attach the file to. |

## Return Type

**Number**

Attaches all attachments from the incoming email to a specific issue.

## Example

```
IncomingEmail email = getIncomingEmail();
string issueKey = matchText(email.subject, "[A-Z][A-Z]+-[0-9]+"); // find an issue key in the subject
if(isNotNull(issueKey)) {
    attachAllFilesFromEmail(issueKey);
}
```

## See also

> Macro (contentbylabel)

> Macro (fc909b09-b512-4c31-a844-dd855b0e6aae/db1c8759-c7e5-4e80-9022-d19e47b0e2b0/static/macro)