How to add attachments in "Send Mail" Activity?
I am trying to figure out how to add an attachment in the "Send Mail " activity. Specifically, I have created an image (jpeg) using the "Export Map " Activity and now want to attach this jpeg image to an email message using the "Send Mail " activity.
Just to be clear, the "Export Map " activity creates a jpeg on the server and the result from this activity is the URL to this exported image. In this activity's help it clearly states that "This image...can be included as an email attachement..."
I am scratching my head on how to create an ICollection of Type Attachment from this single jpeg image to plug into the "Attachments" in-argument of the "Send Mail " activity.
Any help or examples of this type of thing (how to create an ICollection of Type Attachment--specifically of an image) would be much appreciated!
Thanks!
Michael
-
First, load the file into an array of byte. Then, create the attachment using an Assign activity: attachment = New Attachment(new MemoryStream(byteArray), "image/jpeg")And finally, set the Attachment property of the SendMail activity to:New Collection(Of Attachment) From { attachment }Of course, you can combine these two statements, at the cost of some readability.
You may need to load some extra libraries (on the Import tab, to the right of Variables and Arguments): Add System.Net.Mail and possibly System.IO.0 -
Hi Berend,
Could you please elaborate more the attachment configuration process, or can you share you workflow.
Thank you in advance,
Best,
?Majdoleen0 -
Majdoleen - Did you figure this out? I am interested in doing the same thing.
Thanks-Shana0 -
Sorry Shana, not yet.
Best,
Majdoleen0
Bitte melden Sie sich an, um einen Kommentar zu hinterlassen.
Kommentare
4 Kommentare