Sending an email attachment

I’m trying to send a file as an email attachment, but I keep getting an error. I can send the email itself successfully with the following code:smtp="my smtp server" myFrom="my email address" subject="Test email from Ignition" body="This is a test email" html=0 to=["destination email"] attachmentNames=[] attachmentData=[] timeout=60000 username="email account username" password="email account password" system.net.sendEmail(smtp,myFrom,subject,body,html,to,attachmentNames,attachmentData,timeout,username,password)I then convert the file to an array of bytes usingattachmentData=system.file.readFileAsBytes("c:\\Temp\\Test.txt") but when I try to send it I get the following apparently truncated error:java.lang.ClassCastException: Cannot coerce value '[B@4813cc' into type: class [[BThis is despite being able to write the array of bytes successfully to another file using system.file.writeFile("c:\\Temp\\Test2.txt",attachmentData)

Actually, that error message isn’t truncated, just somewhat obscure.

What it’s saying is: “I can’t coerce this byte array into an array of byte arrays.” The “attachmentData” argument needs to be a list of byte arrays. Throw some square brackets around it in the invocation and you should be all set.

I tried the following:attachmentData=[system.file.readFileAsBytes("c:\\Temp\\Test.txt")]but get this error:[code]Traceback (innermost last):
File “event:actionPerformed”, line 15, in ?
com.inductiveautomation.ignition.client.gateway_interface.GatewayException: Gateway Error 500: Error sending email.

at com.inductiveautomation.ignition.client.gateway_interface.GatewayInterface.newGatewayException(GatewayInterface.java:236)

at com.inductiveautomation.ignition.client.gateway_interface.GatewayInterface.sendMessage(GatewayInterface.java:211)

at com.inductiveautomation.ignition.client.gateway_interface.GatewayInterface.sendEmail(GatewayInterface.java:455)

at com.inductiveautomation.factorypmi.application.script.builtin.ClientNetUtilities._sendEmail(ClientNetUtilities.java:94)

at com.inductiveautomation.ignition.common.script.builtin.AbstractNetUtilities.sendEmail(AbstractNetUtilities.java:89)

at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)

at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)

at java.lang.reflect.Method.invoke(Unknown Source)

at org.python.core.PyReflectedFunction.__call__(PyReflectedFunction.java)

at com.inductiveautomation.ignition.common.script.ScriptManager$ReflectedInstanceFunction.__call__(ScriptManager.java:286)

at org.python.core.PyObject.__call__(PyObject.java)

at org.python.core.PyObject.invoke(PyObject.java)

at org.python.pycode._pyx5.f$0(<event:actionPerformed>:15)

at org.python.pycode._pyx5.call_function(<event:actionPerformed>)

at org.python.core.PyTableCode.call(PyTableCode.java)

at org.python.core.PyCode.call(PyCode.java)

at org.python.core.Py.runCode(Py.java)

at com.inductiveautomation.ignition.common.script.ScriptManager.runCode(ScriptManager.java:367)

at com.inductiveautomation.factorypmi.application.binding.action.ActionAdapter.runActions(ActionAdapter.java:138)

at com.inductiveautomation.factorypmi.application.binding.action.ActionAdapter.invoke(ActionAdapter.java:280)

at com.inductiveautomation.factorypmi.application.binding.action.RelayInvocationHandler.invoke(RelayInvocationHandler.java:55)

at $Proxy0.actionPerformed(Unknown Source)

at javax.swing.AbstractButton.fireActionPerformed(Unknown Source)

at javax.swing.AbstractButton$Handler.actionPerformed(Unknown Source)

at javax.swing.DefaultButtonModel.fireActionPerformed(Unknown Source)

at javax.swing.DefaultButtonModel.setPressed(Unknown Source)

at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(Unknown Source)

at java.awt.Component.processMouseEvent(Unknown Source)

at javax.swing.JComponent.processMouseEvent(Unknown Source)

at java.awt.Component.processEvent(Unknown Source)

at java.awt.Container.processEvent(Unknown Source)

at java.awt.Component.dispatchEventImpl(Unknown Source)

at java.awt.Container.dispatchEventImpl(Unknown Source)

at java.awt.Component.dispatchEvent(Unknown Source)

at java.awt.LightweightDispatcher.retargetMouseEvent(Unknown Source)

at java.awt.LightweightDispatcher.processMouseEvent(Unknown Source)

at java.awt.LightweightDispatcher.dispatchEvent(Unknown Source)

at java.awt.Container.dispatchEventImpl(Unknown Source)

at java.awt.Window.dispatchEventImpl(Unknown Source)

at java.awt.Component.dispatchEvent(Unknown Source)

at java.awt.EventQueue.dispatchEvent(Unknown Source)

at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)

at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)

at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)

at java.awt.EventDispatchThread.pumpEvents(Unknown Source)

at java.awt.EventDispatchThread.pumpEvents(Unknown Source)

at java.awt.EventDispatchThread.run(Unknown Source)

Caused by: javax.mail.MessagingException: IOException while sending message;
nested exception is:
javax.activation.UnsupportedDataTypeException: no object DCH for MIME type multipart/mixed;
boundary="----=_Part_11_1668104.1268681758890"

at com.sun.mail.smtp.SMTPTransport.sendMessage(SMTPTransport.java:676)

at javax.mail.Transport.send0(Transport.java:189)

at javax.mail.Transport.send(Transport.java:118)

at com.inductiveautomation.ignition.gateway.script.GatewayNetUtilities.sendEmail(GatewayNetUtilities.java:148)

at com.inductiveautomation.ignition.gateway.servlets.Gateway._sendEmail(Gateway.java:1595)

at com.inductiveautomation.ignition.gateway.servlets.Gateway.doPost(Gateway.java:445)

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:128)

at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)

at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)

at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:286)

at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:845)

at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)

at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)

at java.lang.Thread.run(null)

com.inductiveautomation.ignition.client.gateway_interface.GatewayException: com.inductiveautomation.ignition.client.gateway_interface.GatewayException: Gateway Error 500: Error sending email.

at org.python.core.Py.JavaError(Py.java)
at com.inductiveautomation.factorypmi.application.script.builtin.ClientNetUtilities._sendEmail(ClientNetUtilities.java:97)
at com.inductiveautomation.ignition.common.script.builtin.AbstractNetUtilities.sendEmail(AbstractNetUtilities.java:89)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.python.core.PyReflectedFunction.__call__(PyReflectedFunction.java)
at com.inductiveautomation.ignition.common.script.ScriptManager$ReflectedInstanceFunction.__call__(ScriptManager.java:286)
at org.python.core.PyObject.__call__(PyObject.java)
at org.python.core.PyObject.invoke(PyObject.java)
at org.python.pycode._pyx5.f$0(<event:actionPerformed>:15)
at org.python.pycode._pyx5.call_function(<event:actionPerformed>)
at org.python.core.PyTableCode.call(PyTableCode.java)
at org.python.core.PyCode.call(PyCode.java)
at org.python.core.Py.runCode(Py.java)
at com.inductiveautomation.ignition.common.script.ScriptManager.runCode(ScriptManager.java:367)
at com.inductiveautomation.factorypmi.application.binding.action.ActionAdapter.runActions(ActionAdapter.java:138)
at com.inductiveautomation.factorypmi.application.binding.action.ActionAdapter.invoke(ActionAdapter.java:280)
at com.inductiveautomation.factorypmi.application.binding.action.RelayInvocationHandler.invoke(RelayInvocationHandler.java:55)
at $Proxy0.actionPerformed(Unknown Source)
at javax.swing.AbstractButton.fireActionPerformed(Unknown Source)
at javax.swing.AbstractButton$Handler.actionPerformed(Unknown Source)
at javax.swing.DefaultButtonModel.fireActionPerformed(Unknown Source)
at javax.swing.DefaultButtonModel.setPressed(Unknown Source)
at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(Unknown Source)
at java.awt.Component.processMouseEvent(Unknown Source)
at javax.swing.JComponent.processMouseEvent(Unknown Source)
at java.awt.Component.processEvent(Unknown Source)
at java.awt.Container.processEvent(Unknown Source)
at java.awt.Component.dispatchEventImpl(Unknown Source)
at java.awt.Container.dispatchEventImpl(Unknown Source)
at java.awt.Component.dispatchEvent(Unknown Source)
at java.awt.LightweightDispatcher.retargetMouseEvent(Unknown Source)
at java.awt.LightweightDispatcher.processMouseEvent(Unknown Source)
at java.awt.LightweightDispatcher.dispatchEvent(Unknown Source)
at java.awt.Container.dispatchEventImpl(Unknown Source)
at java.awt.Window.dispatchEventImpl(Unknown Source)
at java.awt.Component.dispatchEvent(Unknown Source)
at java.awt.EventQueue.dispatchEvent(Unknown Source)
at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.run(Unknown Source)

Ignition v7.0.4 (b4594)
Java: Sun Microsystems Inc. 1.6.0_18
[/code]

What is the file extension of what you’re sending?

And, what version of Java are you running on the Gateway?

The extension is .txt (it is a text file containing ‘abc’!).

The installed Java is Version 6 Update 18.

Hmm, I’ve only ever seen this once, on another customer’s machine, and the culprit there was Java 6u4. Just want to make sure we’re talking about the same thing - the version of Java running the Gateway. You can be certain about this version by checking it as it is reported in the Config section of the Gateway under System>Status.

Yes, the Gateway reports ‘Sun Microsystems Inc. 1.6.0_18’.

I can’t seem to replicate this…

There is a file under your Ignition installation %Install_Dir%/contexts/main/core/gateway/activation.jar

Rename this file so that it doesn’t end in “.jar” like “activation.jar.x”

Restart your Gateway, try again and let me know if anything changes.

I renamed the file and restarted the Ignition service, but no change.

Ok, next thing to try: download the latest JavaMail release, extract the “mail.jar” file, and replace the one under contexts/main/core/gateway with the newer one. Restart the service and try again.

I replaced mail.jar but still no success, either with the activation.jar left alone or renamed.

That’s me until tomorrow I’m afraid.

For reference, the most recent stack trace (new mail.jar and activation.jar renamed) is as follows:[code]Traceback (innermost last):
File “event:actionPerformed”, line 15, in ?
com.inductiveautomation.ignition.client.gateway_interface.GatewayException: Gateway Error 500: Error sending email.

at com.inductiveautomation.ignition.client.gateway_interface.GatewayInterface.newGatewayException(GatewayInterface.java:236)

at com.inductiveautomation.ignition.client.gateway_interface.GatewayInterface.sendMessage(GatewayInterface.java:211)

at com.inductiveautomation.ignition.client.gateway_interface.GatewayInterface.sendEmail(GatewayInterface.java:455)

at com.inductiveautomation.factorypmi.application.script.builtin.ClientNetUtilities._sendEmail(ClientNetUtilities.java:94)

at com.inductiveautomation.ignition.common.script.builtin.AbstractNetUtilities.sendEmail(AbstractNetUtilities.java:89)

at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)

at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)

at java.lang.reflect.Method.invoke(Unknown Source)

at org.python.core.PyReflectedFunction.__call__(PyReflectedFunction.java)

at com.inductiveautomation.ignition.common.script.ScriptManager$ReflectedInstanceFunction.__call__(ScriptManager.java:286)

at org.python.core.PyObject.__call__(PyObject.java)

at org.python.core.PyObject.invoke(PyObject.java)

at org.python.pycode._pyx0.f$0(<event:actionPerformed>:15)

at org.python.pycode._pyx0.call_function(<event:actionPerformed>)

at org.python.core.PyTableCode.call(PyTableCode.java)

at org.python.core.PyCode.call(PyCode.java)

at org.python.core.Py.runCode(Py.java)

at com.inductiveautomation.ignition.common.script.ScriptManager.runCode(ScriptManager.java:367)

at com.inductiveautomation.factorypmi.application.binding.action.ActionAdapter.runActions(ActionAdapter.java:138)

at com.inductiveautomation.factorypmi.application.binding.action.ActionAdapter.invoke(ActionAdapter.java:280)

at com.inductiveautomation.factorypmi.application.binding.action.RelayInvocationHandler.invoke(RelayInvocationHandler.java:55)

at $Proxy0.actionPerformed(Unknown Source)

at javax.swing.AbstractButton.fireActionPerformed(Unknown Source)

at javax.swing.AbstractButton$Handler.actionPerformed(Unknown Source)

at javax.swing.DefaultButtonModel.fireActionPerformed(Unknown Source)

at javax.swing.DefaultButtonModel.setPressed(Unknown Source)

at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(Unknown Source)

at java.awt.Component.processMouseEvent(Unknown Source)

at javax.swing.JComponent.processMouseEvent(Unknown Source)

at java.awt.Component.processEvent(Unknown Source)

at java.awt.Container.processEvent(Unknown Source)

at java.awt.Component.dispatchEventImpl(Unknown Source)

at java.awt.Container.dispatchEventImpl(Unknown Source)

at java.awt.Component.dispatchEvent(Unknown Source)

at java.awt.LightweightDispatcher.retargetMouseEvent(Unknown Source)

at java.awt.LightweightDispatcher.processMouseEvent(Unknown Source)

at java.awt.LightweightDispatcher.dispatchEvent(Unknown Source)

at java.awt.Container.dispatchEventImpl(Unknown Source)

at java.awt.Window.dispatchEventImpl(Unknown Source)

at java.awt.Component.dispatchEvent(Unknown Source)

at java.awt.EventQueue.dispatchEvent(Unknown Source)

at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)

at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)

at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)

at java.awt.EventDispatchThread.pumpEvents(Unknown Source)

at java.awt.EventDispatchThread.pumpEvents(Unknown Source)

at java.awt.EventDispatchThread.run(Unknown Source)

Caused by: javax.mail.MessagingException: IOException while sending message;
nested exception is:
javax.activation.UnsupportedDataTypeException: no object DCH for MIME type multipart/mixed;
boundary="----=_Part_0_24800151.1268764983171"

at com.sun.mail.smtp.SMTPTransport.sendMessage(SMTPTransport.java:930)

at javax.mail.Transport.send0(Transport.java:191)

at javax.mail.Transport.send(Transport.java:120)

at com.inductiveautomation.ignition.gateway.script.GatewayNetUtilities.sendEmail(GatewayNetUtilities.java:148)

at com.inductiveautomation.ignition.gateway.servlets.Gateway._sendEmail(Gateway.java:1595)

at com.inductiveautomation.ignition.gateway.servlets.Gateway.doPost(Gateway.java:445)

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:128)

at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)

at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)

at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:286)

at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:845)

at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)

at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)

at java.lang.Thread.run(null)

com.inductiveautomation.ignition.client.gateway_interface.GatewayException: com.inductiveautomation.ignition.client.gateway_interface.GatewayException: Gateway Error 500: Error sending email.

at org.python.core.Py.JavaError(Py.java)
at com.inductiveautomation.factorypmi.application.script.builtin.ClientNetUtilities._sendEmail(ClientNetUtilities.java:97)
at com.inductiveautomation.ignition.common.script.builtin.AbstractNetUtilities.sendEmail(AbstractNetUtilities.java:89)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.python.core.PyReflectedFunction.__call__(PyReflectedFunction.java)
at com.inductiveautomation.ignition.common.script.ScriptManager$ReflectedInstanceFunction.__call__(ScriptManager.java:286)
at org.python.core.PyObject.__call__(PyObject.java)
at org.python.core.PyObject.invoke(PyObject.java)
at org.python.pycode._pyx0.f$0(<event:actionPerformed>:15)
at org.python.pycode._pyx0.call_function(<event:actionPerformed>)
at org.python.core.PyTableCode.call(PyTableCode.java)
at org.python.core.PyCode.call(PyCode.java)
at org.python.core.Py.runCode(Py.java)
at com.inductiveautomation.ignition.common.script.ScriptManager.runCode(ScriptManager.java:367)
at com.inductiveautomation.factorypmi.application.binding.action.ActionAdapter.runActions(ActionAdapter.java:138)
at com.inductiveautomation.factorypmi.application.binding.action.ActionAdapter.invoke(ActionAdapter.java:280)
at com.inductiveautomation.factorypmi.application.binding.action.RelayInvocationHandler.invoke(RelayInvocationHandler.java:55)
at $Proxy0.actionPerformed(Unknown Source)
at javax.swing.AbstractButton.fireActionPerformed(Unknown Source)
at javax.swing.AbstractButton$Handler.actionPerformed(Unknown Source)
at javax.swing.DefaultButtonModel.fireActionPerformed(Unknown Source)
at javax.swing.DefaultButtonModel.setPressed(Unknown Source)
at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(Unknown Source)
at java.awt.Component.processMouseEvent(Unknown Source)
at javax.swing.JComponent.processMouseEvent(Unknown Source)
at java.awt.Component.processEvent(Unknown Source)
at java.awt.Container.processEvent(Unknown Source)
at java.awt.Component.dispatchEventImpl(Unknown Source)
at java.awt.Container.dispatchEventImpl(Unknown Source)
at java.awt.Component.dispatchEvent(Unknown Source)
at java.awt.LightweightDispatcher.retargetMouseEvent(Unknown Source)
at java.awt.LightweightDispatcher.processMouseEvent(Unknown Source)
at java.awt.LightweightDispatcher.dispatchEvent(Unknown Source)
at java.awt.Container.dispatchEventImpl(Unknown Source)
at java.awt.Window.dispatchEventImpl(Unknown Source)
at java.awt.Component.dispatchEvent(Unknown Source)
at java.awt.EventQueue.dispatchEvent(Unknown Source)
at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.run(Unknown Source)

Ignition v7.0.5 (b4679)
Java: Sun Microsystems Inc. 1.6.0_18
[/code]

Just adding my 2 cents worth…

Have a look at http://www.jguru.com/faq/view.jsp?EID=237257
I know it’s more about java but there is an entry in it that appears to present a solution for this type of problem.

Peter

I am having the same error and have now done everything asked in this thread and still have the same error.

It looks like my problem with email sending.

Code is:

##file config and data

#file name
filename=“ping.txt”
#path to file
filepath=“C:\”
#name of the attachment file? on recived message
attachmentName=filename
#data of the file
attachmentData=system.file.readFileAsBytes(filepath+filename)

##email config

#address of POP server : encryption : port
pop=“192.168.1.51:25:ssl”
#my e-mail address
myfrom="test@192.168.1.51"
#Title of the message
subject=“Test”
#Body of the message
body=“this is to test mail send \n” + filepath + “\n”
#enable html mode on message (0=No, 1=Yes)
html=0
#e-mail(s) to sent to
to=[“test2@192.168.1.51”]
##authentification on pop server (if exists)
#username
username1="test@192.168.1.51"
#passwod
password1=“test”
system.net.sendEmail(pop,myfrom,subject,body,html,to,[attachmentName],[attachmentData],username=username1,password=password1)

The entire stack trace of the error message:

Traceback (most recent call last):
File “”, line 32, in
at com.inductiveautomation.ignition.client.gateway_interface.GatewayInterface.newGatewayException(GatewayInterface.java:313)

at com.inductiveautomation.ignition.client.gateway_interface.GatewayInterface.sendMessage(GatewayInterface.java:287)

at com.inductiveautomation.ignition.client.gateway_interface.GatewayInterface.sendEmail(GatewayInterface.java:617)

at com.inductiveautomation.factorypmi.application.script.builtin.ClientNetUtilities._sendEmail(ClientNetUtilities.java:102)

at com.inductiveautomation.ignition.common.script.builtin.AbstractNetUtilities.sendEmail(AbstractNetUtilities.java:88)

at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)

at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)

at java.lang.reflect.Method.invoke(Unknown Source)

com.inductiveautomation.ignition.client.gateway_interface.GatewayException: com.inductiveautomation.ignition.client.gateway_interface.GatewayException: Error sending email.

at org.python.core.Py.JavaError(Py.java:495)
at com.inductiveautomation.factorypmi.application.script.builtin.ClientNetUtilities._sendEmail(ClientNetUtilities.java:105)
at com.inductiveautomation.ignition.common.script.builtin.AbstractNetUtilities.sendEmail(AbstractNetUtilities.java:88)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.python.core.PyReflectedFunction.__call__(PyReflectedFunction.java:186)
at com.inductiveautomation.ignition.common.script.ScriptManager$ReflectedInstanceFunction.__call__(ScriptManager.java:459)
at org.python.core.PyObject.__call__(PyObject.java:320)
at org.python.pycode._pyx11.f$0(<script playground>:32)
at org.python.pycode._pyx11.call_function(<script playground>)
at org.python.core.PyTableCode.call(PyTableCode.java:165)
at org.python.core.PyCode.call(PyCode.java:18)
at org.python.core.Py.runCode(Py.java:1275)
at com.inductiveautomation.ignition.common.script.ScriptManager.runCode(ScriptManager.java:552)
at com.inductiveautomation.ignition.common.script.ScriptManager.runCode(ScriptManager.java:545)
at com.inductiveautomation.ignition.designer.gui.tools.ScriptPlayground.runScript(ScriptPlayground.java:203)
at com.inductiveautomation.ignition.designer.gui.tools.ScriptPlayground$2.actionPerformed(ScriptPlayground.java:219)
at javax.swing.AbstractButton.fireActionPerformed(Unknown Source)
at javax.swing.AbstractButton$Handler.actionPerformed(Unknown Source)
at javax.swing.DefaultButtonModel.fireActionPerformed(Unknown Source)
at javax.swing.DefaultButtonModel.setPressed(Unknown Source)
at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(Unknown Source)
at java.awt.AWTEventMulticaster.mouseReleased(Unknown Source)
at java.awt.Component.processMouseEvent(Unknown Source)
at javax.swing.JComponent.processMouseEvent(Unknown Source)
at java.awt.Component.processEvent(Unknown Source)
at java.awt.Container.processEvent(Unknown Source)
at java.awt.Component.dispatchEventImpl(Unknown Source)
at java.awt.Container.dispatchEventImpl(Unknown Source)
at java.awt.Component.dispatchEvent(Unknown Source)
at java.awt.LightweightDispatcher.retargetMouseEvent(Unknown Source)
at java.awt.LightweightDispatcher.processMouseEvent(Unknown Source)
at java.awt.LightweightDispatcher.dispatchEvent(Unknown Source)
at java.awt.Container.dispatchEventImpl(Unknown Source)
at java.awt.Window.dispatchEventImpl(Unknown Source)
at java.awt.Component.dispatchEvent(Unknown Source)
at java.awt.EventQueue.dispatchEventImpl(Unknown Source)
at java.awt.EventQueue.access$200(Unknown Source)
at java.awt.EventQueue$3.run(Unknown Source)
at java.awt.EventQueue$3.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.ProtectionDomain$1.doIntersectionPrivilege(Unknown Source)
at java.security.ProtectionDomain$1.doIntersectionPrivilege(Unknown Source)
at java.awt.EventQueue$4.run(Unknown Source)
at java.awt.EventQueue$4.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.ProtectionDomain$1.doIntersectionPrivilege(Unknown Source)
at java.awt.EventQueue.dispatchEvent(Unknown Source)
at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.run(Unknown Source)

Caused by: com.inductiveautomation.ignition.client.gateway_interface.GatewayException: Error sending email.
at com.inductiveautomation.ignition.client.gateway_interface.GatewayInterface.newGatewayException(GatewayInterface.java:313)
at com.inductiveautomation.ignition.client.gateway_interface.GatewayInterface.sendMessage(GatewayInterface.java:287)
at com.inductiveautomation.ignition.client.gateway_interface.GatewayInterface.sendEmail(GatewayInterface.java:617)
at com.inductiveautomation.factorypmi.application.script.builtin.ClientNetUtilities._sendEmail(ClientNetUtilities.java:102)
… 54 more
Caused by: javax.mail.MessagingException: IOException while sending message;
nested exception is:
javax.activation.UnsupportedDataTypeException: no object DCH for MIME type multipart/mixed;
boundary="----=_Part_15_5034459.1368627210209"
at com.sun.mail.smtp.SMTPTransport.sendMessage(SMTPTransport.java:1177)
at javax.mail.Transport.send0(Transport.java:195)
at javax.mail.Transport.send(Transport.java:124)
at com.inductiveautomation.ignition.gateway.script.GatewayNetUtilities.sendEmail(GatewayNetUtilities.java:148)
at com.inductiveautomation.ignition.gateway.servlets.Gateway._sendEmail(Gateway.java:1427)
at com.inductiveautomation.ignition.gateway.servlets.Gateway.doPost(Gateway.java:442)
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)

Ignition v7.6.0 (b1875)
Java: Oracle Corporation 1.7.0_21

Without the attachment I can send the email.

Maybe there is a solution like “finished using rasp”?

Thanks in advance

andrey, your issue is an error introduced in Ignition 7.6.0. It is fixed for Ignition 7.6.1 (rc2 or later).