Paste images in outlook mail body

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?

@yogitagaikwad2206

  1. Read Images from Folder:
  • Assign activity:
    • To: imageFiles
    • Value: Directory.GetFiles("C:\YourFolderPath\", "*.jpg")
  1. Initialize HTML Body:
  • Assign activity:
    • To: emailBody
    • Value: "<html><body>"
  1. For Each Image File:
  • For Each activity (TypeArgument: String):
    • Values: imageFiles
    • Body:
      • Assign activity:
        • To: emailBody
        • Value: emailBody & "<img src='cid:" & Path.GetFileName(item) & "' />"
  1. Close HTML Body:
  • Assign activity:
    • To: emailBody
    • Value: emailBody & "</body></html>"
  1. 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”)

can u plz tell me about this error

image is folder name

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


Is this for each is right?

image

we recommend to check:

  • the used Mail Send Type (Outlook, GMail…) and check what is supported
  • then choose the approach: e.g. CID, Base64 …

someone can u tell me what changes i have to do here for my path

This is my workflow

!

@yogitagaikwad2206

Pass the CurrentText or CurrentItem which is available in the for each


i declare current item to item but same error

@yogitagaikwad2206

Item “I” should be capital

@yogitagaikwad2206
Change the argument type to string in the for each

1 Like

image
can u tell me why this error come
This is my workflow
Email.xaml (11.6 KB)