# Issue with sending email with pdf report attachments

**URL:** <https://discuss.elastic.co/t/issue-with-sending-email-with-pdf-report-attachments/53701>\
**Category:** Elasticsearch\
**Created:** [June 22, 2016, 6:45pm UTC](https://discuss.elastic.co/t/issue-with-sending-email-with-pdf-report-attachments/53701 "2016-06-22T18:45:22Z")\
**Posts on this page:** 12\
**Page:** 1

<div class="post-metadata">

**Author:** ![vinayakravi](https://avatars.discourse-cdn.com/v4/letter/v/7c8e57/32.png) [@vinayakravi](https://discuss.elastic.co/u/vinayakravi)\
**Post date:** [June 22, 2016, 6:45pm UTC](https://discuss.elastic.co/t/issue-with-sending-email-with-pdf-report-attachments/53701/1 "2016-06-22T18:45:22Z")

</div>

I'm experiencing an issue with x-pack 5.0.0 alpha 3. I've set up an email action in XPack Watcher to send an email with a PDF attachment of a report as follows:

```
"attachments": {
          "my_report.pdf": {
            "http": {
              "content_type": "application/pdf",
              "request": {
                "url": "http://localhost:5601/reporting/dashboard/Dashboard?_g"
              }
            }
          },
          "data.yml": {
            "data": {
              "format": "yaml"
            }
          }

```

"Dashboard" is the id of my dashboard object.

I get the following error message when I check the status of the watch:  
"actions": [  
{  
"id": "send\_email",  
"type": "email",  
"status": "failure",  
"reason": "Unable to get attachment of type [http] with id [my\_report.pdf] in watch [scorecard\_4] aborting watch execution"  
}  
]

I get a 404 error if I try to access the URL [http://hostname:5601/reporting/dashboard/Dashboard?\_g](http://hostname:5601/reporting/dashboard/Dashboard?_g)

I've tried specifying the time parameters to the URL and I still see the same issues.

Has anyone encountered this before? Any advice or help will be much appreciated.

Thanks

---

<div class="post-metadata">

**Author:** ![vinayakravi](https://avatars.discourse-cdn.com/v4/letter/v/7c8e57/32.png) [@vinayakravi](https://discuss.elastic.co/u/vinayakravi)\
**Post date:** [June 30, 2016, 10:06pm UTC](https://discuss.elastic.co/t/issue-with-sending-email-with-pdf-report-attachments/53701/2 "2016-06-30T22:06:46Z")

</div>

After installing Xpack 5.0.0 alpha4, I updated the "url" field of the request object to "[http://localhost:5601/api/reporting/generate/dashboard/New-Dashboard](http://localhost:5601/api/reporting/generate/dashboard/New-Dashboard)". This queues up the report to be executed as a background process.

Can I attach the generated report to the email as part of the Watcher email action? - Is it possible to query for the URL of the the generated PDF?

Thanks,  
Vinayak

---

<div class="post-metadata">

**Author:** ![mrvincnezo](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/mrvincnezo/32/10829_2.png) [@mrvincnezo](https://discuss.elastic.co/u/mrvincnezo)\
**Post date:** [July 12, 2016, 11:38am UTC](https://discuss.elastic.co/t/issue-with-sending-email-with-pdf-report-attachments/53701/3 "2016-07-12T11:38:45Z")

</div>

Same here. I wonder if it is possible to generate & attach report to `email` action.

I noticed that the response to `reporting/generate` contains an `id` which is the reporting job id. The job id can then be concatenated to `http://localhost:5601/api/reporting/jobs/download/` to form a url to download the report.

Suppose the `id` is `iqjdo57d0726f7fb244dxvgp`, the url will be `http://localhost:5601/api/reporting/jobs/download/iqjdo57d0726f7fb244dxvgp`. This works fine if I open this link in any browser but when I try to attach it in the `email` action as the `url` for the `request` it corrupts pdf...

---

<div class="post-metadata">

**Author:** ![mrvincnezo](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/mrvincnezo/32/10829_2.png) [@mrvincnezo](https://discuss.elastic.co/u/mrvincnezo)\
**Post date:** [July 12, 2016, 11:56am UTC](https://discuss.elastic.co/t/issue-with-sending-email-with-pdf-report-attachments/53701/4 "2016-07-12T11:56:40Z")

</div>

I think that the download from `reporting/jobs/download` fails during `email` action because of authentication. Disabling X-Pack security fixed the issue.

I will try to modify the `request` in the `email` action to contain `auth` (Authentication related HTTP headers. Currently, only basic authentication is supported.)

---

<div class="post-metadata">

**Author:** ![spinscale](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/spinscale/32/25011_2.png) [@spinscale](https://discuss.elastic.co/u/spinscale)\
**Post date:** [July 12, 2016, 12:53pm UTC](https://discuss.elastic.co/t/issue-with-sending-email-with-pdf-report-attachments/53701/5 "2016-07-12T12:53:59Z")

</div>

Hey,

right now, there is no synchronous downloading of that PDF, you can just trigger its creation. This will come very soon though, so that watcher will be able to download the PDF directly and attach it to an email.

--Alex

---

<div class="post-metadata">

**Author:** ![mrvincnezo](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/mrvincnezo/32/10829_2.png) [@mrvincnezo](https://discuss.elastic.co/u/mrvincnezo)\
**Post date:** [July 12, 2016, 1:08pm UTC](https://discuss.elastic.co/t/issue-with-sending-email-with-pdf-report-attachments/53701/6 "2016-07-12T13:08:52Z")

</div>

Thank you for your quick response. One question though (actually two) - any chance that soon is 5 GA release?

The second question - is it possible to download that PDF when Security (Shield) enabled? When Security is off, I am able to specify the report's url in the `email` action in `http` in `request` and everything works like a charm. When Security is on it doesn't work. I tried adding basic authentication by adding the `auth` to the `request` (similar to WebHook examples) but it didn't help either.

Thank you!

---

<div class="post-metadata">

**Author:** ![mrvincnezo](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/mrvincnezo/32/10829_2.png) [@mrvincnezo](https://discuss.elastic.co/u/mrvincnezo)\
**Post date:** [July 14, 2016, 6:57am UTC](https://discuss.elastic.co/t/issue-with-sending-email-with-pdf-report-attachments/53701/7 "2016-07-14T06:57:00Z")

</div>

@spinscale?

---

<div class="post-metadata">

**Author:** ![Yasho](https://avatars.discourse-cdn.com/v4/letter/y/c2a13f/32.png) [@Yasho](https://discuss.elastic.co/u/Yasho)\
**Post date:** [July 14, 2016, 11:26am UTC](https://discuss.elastic.co/t/issue-with-sending-email-with-pdf-report-attachments/53701/8 "2016-07-14T11:26:06Z")

</div>

+1 @spinscale please reply if this feature will be made available.

---

<div class="post-metadata">

**Author:** ![spinscale](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/spinscale/32/25011_2.png) [@spinscale](https://discuss.elastic.co/u/spinscale)\
**Post date:** [July 15, 2016, 7:35am UTC](https://discuss.elastic.co/t/issue-with-sending-email-with-pdf-report-attachments/53701/9 "2016-07-15T07:35:08Z")

</div>

Hey,

there will be beta releases before GA, so this will take some more time. And yes, it will be possible to download PDFs with security enabled. All we need is the ability to download the PDF in sync from Kibana, which will be released with the next test version of the Elastic Stack.

--Alex

---

<div class="post-metadata">

**Author:** ![mrvincnezo](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/mrvincnezo/32/10829_2.png) [@mrvincnezo](https://discuss.elastic.co/u/mrvincnezo)\
**Post date:** [July 19, 2016, 8:52am UTC](https://discuss.elastic.co/t/issue-with-sending-email-with-pdf-report-attachments/53701/10 "2016-07-19T08:52:11Z")

</div>

Thanks!

---

<div class="post-metadata">

**Author:** ![Yasho](https://avatars.discourse-cdn.com/v4/letter/y/c2a13f/32.png) [@Yasho](https://discuss.elastic.co/u/Yasho)\
**Post date:** [July 25, 2016, 6:20am UTC](https://discuss.elastic.co/t/issue-with-sending-email-with-pdf-report-attachments/53701/11 "2016-07-25T06:20:35Z")

</div>

Thank you

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [July 6, 2017, 1:40pm UTC](https://discuss.elastic.co/t/issue-with-sending-email-with-pdf-report-attachments/53701/12 "2017-07-06T13:40:40Z")

</div>


