Ignition Edge sends emails but no attachments

Mine is a little less legible. I might try some different email addresses/smtp Servers to see if i have any more luck

Are you really sending a text file or are you sending some type of rich text or binary encoded file? Can you view the source file in a plain text editor (such as Windows Notepad)? What is the source of the file?

Its a text file .txt that I created in windows explorer. That screenshot is from windows notepad.

1 Like

What's the exact script you're using? Mangled data like that suggests a charset encoding/detection issue. If you're using readFileAsBytes and attachmentData, then that confusion isn't on Ignition's end, because we're treating the file as opaque bytes that won't be adjusted. Maybe try a different application or see if you can force Notepad to read it with a different content type :person_shrugging:

filePath = system.file.openFile()
if filePath != None:
   # This gets the filename without the C:\folder stuff
   fileName = filePath.split("\\")[-1]
   fileData = system.file.readFileAsBytes(filePath)
   smtp_server = "ECS Email Profile Name"
   sender = "o___r@en___g.com.au"
   subject_mail = "Here is the file you requested"
   body_mail = "Hello, this is an email."
   recipients = ["m_____@____.com"]

   system.net.sendEmail(
   	smtpProfile = smtp_server, fromAddr = sender, 
   	subject = subject_mail, body = body_mail, html = 0, 
   	to = recipients, attachmentNames = [fileName], 
   	attachmentData = [fileData])

This is the script. The only extra information I can think that might make anything different
-Using Ignition Edge 8.3.0
-Have to and from both a M365 account and a Gmail account to send (both the same result)
-Have run the script from a button on the vision editor rather than a separate client

Random thoughts:

Have given that a whirl too now. Still no luck. I might try from a different device with 8.1.x installed

8.1.x Works perfectly…..
Might need to lodge a ticket to the mothership

1 Like