Sending email with .ics attachment

Hello everybody,

I want to send an Email with an attachment with “.ics” extension.
However, i have this error message

Any solutions ?

Thanks in advance

It might help to show how you are sending the email, and how you are attaching the ics file

1 Like

as you can see, i have a .txt file that i want to convert in .ics file.

I am able to send the email when i switch to “templateics.txt”

The other question I forgot to ask was, what version of Ignition, and where are you sending it from (vision? perspective?) ?

I assume that you see the actual file in the label. And from you comment, do you mean that when you change

["templates.ics"] to ["templateics.txt"]

In the sendEmail call, That you can send the file?

sorry …

I am using ignition 8.1.14 and i am sending it from perspective.

that’s it, when i give “templateics.txt” as Filename argument i receive the email correctly with the attachment.

Hmm. I think .ics files may not have an associated MIME type by default… this may be something that requires a feature or bug fix.

A way to explicitly set mime types for each attachment would be ideal…

2 Likes

If there is no explicit mime type associated with a file type (in this case an ics file), why doesn’t the system default to a sensible mime type of something like “octet-stream”?

It probably should have done something like that, but this is some of the oldest code in Ignition and it doesn’t. I don’t know if this case has never been tested or if it used to work but now doesn’t as the result of some change in the last 10-15 years.

I opened a ticket for this either way.

3 Likes

Mwah-ha-ha!! You dreamer, you.

2 Likes

Would there be a way to to bypass sendEmail, and construct and send the email as raw data? I’ve seen references online to the Python smtplib module, but I have no idea if this is available under Jython, or an equivalent under Java?

Probably need to start here:

https://javaee.github.io/javamail/docs/api/

One downside is that the Ignition sendEmail automatically routes the email via the GW so that the client doesn’t need direct SMTP access to the mail server. I guess that you could achieve this by creating a GW script that handled the email sending and calling that from the client.

I considered that a given. (: