# Custom Reports by Email

**URL:** <https://forums.losant.com/t/custom-reports-by-email/1306>\
**Category:** Help\
**Created:** [December 12, 2018, 5:49pm UTC](https://forums.losant.com/t/custom-reports-by-email/1306 "2018-12-12T17:49:35Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![paul\_wareham](https://avatars.discourse-cdn.com/v4/letter/p/ed8c4c/32.png) [@paul\_wareham](https://forums.losant.com/u/paul_wareham)\
**Post date:** [December 12, 2018, 5:49pm UTC](https://forums.losant.com/t/custom-reports-by-email/1306/1 "2018-12-12T17:49:35Z")

</div>

I realize there are built-in dashboard reports for emailing but they are pretty limited. Many of our users want a custom report with some key insights based on their application - more than just a data snapshot. For example some type of reports used for auditing, or compliance, etc. Are there any tools or third party integrations any of you can suggest to make creating custom email reports quicker and easier?

---

<div class="post-metadata">

**Author:** ![Tim\_Hoffman](https://avatars.discourse-cdn.com/v4/letter/t/ebca7d/32.png) [@Tim\_Hoffman](https://forums.losant.com/u/Tim_Hoffman)\
**Post date:** [December 12, 2018, 11:44pm UTC](https://forums.losant.com/t/custom-reports-by-email/1306/2 "2018-12-12T23:44:38Z")

</div>

I am going through the same process at the moment.

I can;t work out how to create attachments using the mail / sendgrid node.

So I am grabbing the report output (csv in my case) from a workflow via web hook then mailing it from our internal systems. ( It would be easy to do this from cloudfunctions, or appengine with a cron as well)

---

<div class="post-metadata">

**Author:** ![paul\_wareham](https://avatars.discourse-cdn.com/v4/letter/p/ed8c4c/32.png) [@paul\_wareham](https://forums.losant.com/u/paul_wareham)\
**Post date:** [December 21, 2018, 1:12am UTC](https://forums.losant.com/t/custom-reports-by-email/1306/3 "2018-12-21T01:12:36Z")

</div>

Would you mind posting a screen shot example of how you are doing that?

---

<div class="post-metadata">

**Author:** ![Tim\_Hoffman](https://avatars.discourse-cdn.com/v4/letter/t/ebca7d/32.png) [@Tim\_Hoffman](https://forums.losant.com/u/Tim_Hoffman)\
**Post date:** [December 21, 2018, 2:19am UTC](https://forums.losant.com/t/custom-reports-by-email/1306/4 "2018-12-21T02:19:40Z")

</div>

Hi Paul

In is simplest form I use a basic script (uses ubuntu heirloom-mailx package) for the mailx command

And it use a webhook to call a workflow. This script is run via cron.

 ![image](https://us1.discourse-cdn.com/flex015/uploads/getstructure/original/1X/1f2cae968ed62e833a42f5f6e6e6ad27a4a342da.png)

```
#!/bin/bash

DAY=`date +%Y-%m-%d`
CUSTOMER="XXXXXX"
RECIPIENT="xxx@xxxxx"
CC="xxxx@xxxxxxx"

MSG=$(cat <<EOF

Please find attached the duty report for the date ${DAY} for ${SITE}

Do not reply to this email, please contact your account manager if you have any queries.

EOF
)

FILE="${DAY}_xxxx_data.csv"

wget -O ${FILE} https://triggers.losant.com/webhooks/[SOMETRIGGER]

echo "${MSG}" | mailx -v -s "Duty report for ${CUSTOMER}" -S smtp-use-starttls -S ssl-verify=ignore -S smtp-auth=login -S smtp=[mailserver] -S from=[SERVICE ACCCOUNT] -S smtp-auth-user=[SERVICE AUTH USER] -S smtp-auth-password=[PASSWORD] -a ${FILE} -c ${CC} ${RECIPIENT}
```
