# How to add the second attachment onto Perspective email

**URL:** <https://forum.inductiveautomation.com/t/how-to-add-the-second-attachment-onto-perspective-email/88582>\
**Category:** Ignition\
**Tags:** perspective\
**Created:** [April 9, 2024, 3:14pm UTC](https://forum.inductiveautomation.com/t/how-to-add-the-second-attachment-onto-perspective-email/88582 "2024-04-09T15:14:02Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![jdenchev](https://avatars.discourse-cdn.com/v4/letter/j/f4b2a3/32.png) [@jdenchev](https://forum.inductiveautomation.com/u/jdenchev)\
**Post date:** [April 9, 2024, 3:14pm UTC](https://forum.inductiveautomation.com/t/how-to-add-the-second-attachment-onto-perspective-email/88582/1 "2024-04-09T15:14:02Z")

</div>

I set up a button to click to email out a PDF report as attachment. However, how can I add the second attachment PDF to the same email? It means I can send out one email with two attachment. How can I do that?

def runAction(self, event):

```
params = {}

reportViewer = self.parent.parent.getChild("FlexContainer_Report").getChild("ReportViewer")

for par in reportViewer.props.params:
    params[par] = reportViewer.props.params[par]
    
system.perspective.print(str(params))

BU = 'BU123'
LoadId = 'LoadId123'
OrderNum = 'Order123'

reportName = 'report123'
Subject = 'subject123'
EmailFrom = '123@567.com'
EmailTo ='123@567.com'

# Executes and distributes the report to an email address.
EmailSettings = {
    "to": [EmailTo],
    "smtpServerName": "Email",
    "from": EmailFrom,
    "attachmentName": reportName,
    "format": "pdf",
    "subject": Subject
}
reportPath = "JD/PickReport"
projectName = "PickingShipping_WIP"
system.report.executeAndDistribute(action='email', path=reportPath, project=projectName, parameters=params, actionSettings=EmailSettings)

```

Thanks

Judy

---

<div class="post-metadata">

**Author:** ![pturmel](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pturmel/32/3295_2.png) [@pturmel](https://forum.inductiveautomation.com/u/pturmel)\
**Post date:** [April 9, 2024, 3:25pm UTC](https://forum.inductiveautomation.com/t/how-to-add-the-second-attachment-onto-perspective-email/88582/2 "2024-04-09T15:25:53Z")

</div>

You wouldn't use `system.report.executeAndDistribute()`. Instead, you would use `system.report.execute()` to retrieve the bytes of the PDF (one or more times), then custom assemble and send the email via [system.net.sendEmail()](https://www.docs.inductiveautomation.com/docs/8.1/appendix/scripting-functions/system-net/system-net-sendEmail). You can have as many attachments as you like.
