Hello, I am having a problem with system.net.sendEmail. I am using the exact script for sending attachments showed in: https://docs.inductiveautomation.com/display/DOC80/system.net.sendEmail. But i keep on getting an error (java.lang.ClassCastException: java.lang.ClassCastException: Cannot coerce value '[u'TI00365FEN_1714.pdf']' into type: class java.lang.Boolean). I have sent emails without an attachment using the documentation in the same web page.
Here is my code (The indentention is correct, but I don't know how to indent it ) :
filePath = system.file.openFile()
if filePath != None:
fileName = filePath.split("\")[-1]
fileData = system.file.readFileAsBytes(filePath)
print fileData
subject = "Here is the file you requested"
body = "Hello, this is an email."
recipients = ["recipient@gmail.com"]
system.net.sendEmail(subject, body, 0, recipients, [fileName], [fileData], smptProfile="Mail")``
Also, I believe you need to read the files that you want to attach and get the binary data from them which you would include within the attachmentData array.
Was just getting ready to post that according to the function signature found here in the manual, you’re actually supplying the fileData array as the html flag.