Someone can help me I want to Copy multiple images from folder and paste in outlook mail body how i do it and if possible plz send sample workflow?
- Read Images from Folder:
Assign
activity:To
:imageFiles
Value
:Directory.GetFiles("C:\YourFolderPath\", "*.jpg")
- Initialize HTML Body:
Assign
activity:To
:emailBody
Value
:"<html><body>"
- For Each Image File:
For Each
activity (TypeArgument: String):Values
:imageFiles
Body
:Assign
activity:To
:emailBody
Value
:emailBody & "<img src='cid:" & Path.GetFileName(item) & "' />"
- Close HTML Body:
Assign
activity:To
:emailBody
Value
:emailBody & "</body></html>"
- Send Outlook Mail Message:
Send Outlook Mail Message
activity:To
:"recipient@example.com"
Subject
:"Subject"
Body
:emailBody
IsBodyHtml
:True
Attachments
:Collection
:
Directory.GetFiles("C:\YourFolderPath", “*.jpg”)
As mentioned here:
Decide if you want to send the images
- as Attachments
- embedded
If further assistance is needed let us know which option (Attachment, embedded) is to address
UPD1 - about embedding
we do embed the images by the Base64 approach because of:
- the file is located on a particular file system location (reachable by the sender)
- the file is not located at the receivers end
- so we cannot use a
<img src="PathOnFileSystem"
UPD2 - alternates / Options:
Embedded images required in outlook body
then have a look on the attached resource on how it was done with the Base64 embedings
in general it is about
- retrieve the filepath of the images, which are to send
- construct HTML / HTML Fragment (and also generate the Base64 string
- Send email
Depending on the details / which mail sending (Outlook, GMail) it will work or is blocked, as it is not supported
UPD1 - Reference Added
Can u send workflow for this
just start the modeling and we will guide you. A few hints we already gave
Assign Activity:
arrImgPaths = Directory.GetFiles(“PathToDirOfFiles”)
change the receiving ariable to String Array
i have done but its not working
please share with us the veariable panel where the variable is defined. Thanks
we recommend to check:
- the used Mail Send Type (Outlook, GMail…) and check what is supported
- then choose the approach: e.g. CID, Base64 …
Pass the CurrentText or CurrentItem which is available in the for each
Item “I” should be capital
@yogitagaikwad2206
Change the argument type to string in the for each
can u tell me why this error come
This is my workflow
Email.xaml (11.6 KB)