# Send report by Email

**URL:** <https://forum.inductiveautomation.com/t/send-report-by-email/5153>\
**Category:** Ignition\
**Created:** [September 16, 2012, 3:13pm UTC](https://forum.inductiveautomation.com/t/send-report-by-email/5153 "2012-09-16T15:13:03Z")\
**Posts on this page:** 11\
**Page:** 1

<div class="post-metadata">

**Author:** ![tamerplc](https://avatars.discourse-cdn.com/v4/letter/t/d78d45/32.png) [@tamerplc](https://forum.inductiveautomation.com/u/tamerplc)\
**Post date:** [September 16, 2012, 3:13pm UTC](https://forum.inductiveautomation.com/t/send-report-by-email/5153/1 "2012-09-16T15:13:03Z")

</div>

Hi,  
Can i send generated report automatically by Email?? . i Have reporting Module Ver: 1.5  
I have active-x component .How can i import this active-x in designer?  
Thanks.  
Tamer

---

<div class="post-metadata">

**Author:** ![Travis.Cox](https://avatars.discourse-cdn.com/v4/letter/t/b9bd4f/32.png) [@Travis.Cox](https://forum.inductiveautomation.com/u/Travis.Cox)\
**Post date:** [September 17, 2012, 2:21pm UTC](https://forum.inductiveautomation.com/t/send-report-by-email/5153/2 "2012-09-17T14:21:46Z")

</div>

You can send a report automatically via email only if a client is open. Typically, people open a client on the server machine and make a screen that will generate the report and email it at various times throughout the day. You can use Ignition’s email function:

[inductiveautomation.com/supp … demail.htm](http://www.inductiveautomation.com/support/usermanuals/ignition/system_net_sendemail.htm)

You can get the bytes of a PDF by doing the following:`report = event.source.parent.getComponent("Report")
pdfBytes = report.getBytesPDF()`

---

<div class="post-metadata">

**Author:** ![hazelchr](https://avatars.discourse-cdn.com/v4/letter/h/e9c0ed/32.png) [@hazelchr](https://forum.inductiveautomation.com/u/hazelchr)\
**Post date:** [August 7, 2013, 4:43pm UTC](https://forum.inductiveautomation.com/t/send-report-by-email/5153/3 "2013-08-07T16:43:36Z")

</div>

Ok, I am trying to send an email with a PDF of a report viewer component as an attachment. I am getting the PDF bytes just fine, but I get a MIME type error when I try to send the message:

“caused by GatewayException: Error sending email.  
caused by javax.mail.internet.ParseException: Expected MIME type, got null”

Googling around, it might be that the Content-Type isn’t set correctly. Is there any way to set this, or should I be doing this another way?

[code]from java.util import Date  
from java.util import Calendar  
cal = Calendar.getInstance()  
cal.setTime(Date())  
todayDateStr = system.db.dateFormat(cal.getTime(), “MM/dd/yyyy”)

report=event.source.parent.getComponent(‘Report Viewer’) #Get Report

attachmentData=[report.getBytesPDF()] #Make into PDF data for email  
attachmentNames=[“Report”]  
smtp1 = “XXXXX”  
sender = “XXXXX”  
recipients = [“XXXXXX”]  
subject = “Ignition Email Report for (” + todayDateStr + “)”  
body = “”"  
Report Data goes here  
Another line of text  
“”"  
system.net.sendEmail(smtp1, sender, subject, body, 0, recipients, attachmentNames, attachmentData)  
[/code]

Stack Trace:  
Caused by: javax.mail.internet.ParseException: Expected MIME type, got null  
at javax.mail.internet.ContentType.(ContentType.java:95)  
at javax.mail.internet.MimeBodyPart.updateHeaders(MimeBodyPart.java:1331)  
at javax.mail.internet.MimeBodyPart.updateHeaders(MimeBodyPart.java:1021)  
at javax.mail.internet.MimeMultipart.updateHeaders(MimeMultipart.java:419)  
at javax.mail.internet.MimeBodyPart.updateHeaders(MimeBodyPart.java:1354)  
at javax.mail.internet.MimeMessage.updateHeaders(MimeMessage.java:2107)  
at javax.mail.internet.MimeMessage.saveChanges(MimeMessage.java:2075)  
at javax.mail.Transport.send(Transport.java:123)  
at com.inductiveautomation.ignition.gateway.script.GatewayNetUtilities.sendEmail(GatewayNetUtilities.java:151)  
at com.inductiveautomation.ignition.gateway.servlets.Gateway.\_sendEmail(Gateway.java:1403)  
at com.inductiveautomation.ignition.gateway.servlets.Gateway.doPost(Gateway.java:437)  
at javax.servlet.http.HttpServlet.service(HttpServlet.java:637)  
at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)  
at com.inductiveautomation.ignition.gateway.bootstrap.MapServlet.service(MapServlet.java:85)  
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)  
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)  
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)  
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)  
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)  
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:103)  
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)  
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:293)  
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:861)  
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:606)  
at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:489)  
at java.lang.Thread.run(null)

---

<div class="post-metadata">

**Author:** ![hmatlock](https://avatars.discourse-cdn.com/v4/letter/h/aca169/32.png) [@hmatlock](https://forum.inductiveautomation.com/u/hmatlock)\
**Post date:** [August 7, 2013, 6:32pm UTC](https://forum.inductiveautomation.com/t/send-report-by-email/5153/4 "2013-08-07T18:32:31Z")

</div>

What version of Ignition are you using? I believe there was an issue with the 7.6 or 7.6.1 version that caused a similar error message. Upgrading solved the issue.

---

<div class="post-metadata">

**Author:** ![greg.simpson](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/greg.simpson/32/3135_2.png) [@greg.simpson](https://forum.inductiveautomation.com/u/greg.simpson)\
**Post date:** [August 12, 2013, 8:30pm UTC](https://forum.inductiveautomation.com/t/send-report-by-email/5153/5 "2013-08-12T20:30:11Z")

</div>

There was an issue and it was fixed for Ignition 7.6.1 in regards to email attachments. If upgrading does not work please let us know what version of Ignition you are using.

---

<div class="post-metadata">

**Author:** ![lancekornoelje](https://avatars.discourse-cdn.com/v4/letter/l/90ced4/32.png) [@lancekornoelje](https://forum.inductiveautomation.com/u/lancekornoelje)\
**Post date:** [August 31, 2013, 8:40pm UTC](https://forum.inductiveautomation.com/t/send-report-by-email/5153/6 "2013-08-31T20:40:47Z")

</div>

I am still seeing this error.

I am using stunnel for a secure connection to get to Gmail to send the email.  
I am trying to attach a PDF of the Report Viewer to the email.

If I use None / None for the attachment Name / attachment Data, it works great and goes right through.

If I put in the name / data, I get the following error:

Traceback (most recent call last):

File “event:actionPerformed”, line 8, in

com.inductiveautomation.ignition.client.gateway\_interface.GatewayException: com.inductiveautomation.ignition.client.gateway\_interface.GatewayException: Error sending email.

```
caused by GatewayException: Error sending email.
caused by javax.mail.internet.ParseException: Expected MIME type, got null

```

Ignition v7.6.2 (b2368)  
Java: Sun Microsystems Inc. 1.6.0\_45

---

<div class="post-metadata">

**Author:** ![Micky.Franks](https://avatars.discourse-cdn.com/v4/letter/m/c57346/32.png) [@Micky.Franks](https://forum.inductiveautomation.com/u/Micky.Franks)\
**Post date:** [September 1, 2013, 2:55am UTC](https://forum.inductiveautomation.com/t/send-report-by-email/5153/7 "2013-09-01T02:55:43Z")

</div>

Try adding .pdf to report name

```auto
attachmentNames=["Report.pdf"]
```

Just went through this problem.

---

<div class="post-metadata">

**Author:** ![lancekornoelje](https://avatars.discourse-cdn.com/v4/letter/l/90ced4/32.png) [@lancekornoelje](https://forum.inductiveautomation.com/u/lancekornoelje)\
**Post date:** [September 2, 2013, 1:22pm UTC](https://forum.inductiveautomation.com/t/send-report-by-email/5153/8 "2013-09-02T13:22:29Z")

</div>

Exactly right! Thanks so much. 😃

Lance

---

<div class="post-metadata">

**Author:** ![greg.simpson](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/greg.simpson/32/3135_2.png) [@greg.simpson](https://forum.inductiveautomation.com/u/greg.simpson)\
**Post date:** [September 3, 2013, 6:39pm UTC](https://forum.inductiveautomation.com/t/send-report-by-email/5153/9 "2013-09-03T18:39:56Z")

</div>

Glad to hear it is working!

---

<div class="post-metadata">

**Author:** ![Theodorska](https://avatars.discourse-cdn.com/v4/letter/t/34f0e0/32.png) [@Theodorska](https://forum.inductiveautomation.com/u/Theodorska)\
**Post date:** [December 11, 2024, 1:33pm UTC](https://forum.inductiveautomation.com/t/send-report-by-email/5153/10 "2024-12-11T13:33:04Z")

</div>

Is it only possible to send a report when a client is open? we have a customer who wants reports automatically generated and in their email every month and does not wish to use a client. is this still impossible?

---

<div class="post-metadata">

**Author:** ![Kevin.Herron](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/kevin.herron/32/7259_2.png) [@Kevin.Herron](https://forum.inductiveautomation.com/u/Kevin.Herron)\
**Post date:** [December 11, 2024, 1:51pm UTC](https://forum.inductiveautomation.com/t/send-report-by-email/5153/11 "2024-12-11T13:51:18Z")

</div>

> [@Theodorska](#):
>
> is this still impossible?

No, reporting now "lives" in the Gateway. You no longer need a Vision Client open.

> **[Scheduling Actions | Ignition User Manual](https://docs.inductiveautomation.com/docs/8.1/ignition-modules/reporting/report-schedules/scheduling-actions)**
>
> Scheduling Actions
