Saving Mails having Image on Body using Save mail Message Activity

Hi Team,

Iam Using Save Mail message Activity to save my mail in eml format to Local Folder. If the mail body contains any image , the image is saving as the attachment in local eml file. But here my requirement is i need to get the exact mail with image on mail body itself not as an attachment into my local . Please Suggest any solution. Thanks

@deepak_raj

Use Save Attachments activity

Mark as solution if this helps

Thanks

Iam Using Save Mail message Activity to save my mail in eml format to Local Folder. If the mail body contains any image , the image is saving as the attachment in local eml file. But here my requirement is i need to get the exact mail with image on mail body itself not as an attachment into my local . Please Suggest any solution. Thanks

1 Like

@deepak_raj whenever there is an image in the mail body it is considered as an attachment so instead using save mail message activity use save attachments. It will directly save your inline image at designated folder given by you.

Please mark it as solution if it helped :pray:

@deepak_raj

Using save attachments, you can download the image which are attached / inline

Hope this helps

Thanks

Hi @deepak_raj

If the image is there in the mail body, it should have been added as html body
so while fetching the mail with GET EXCHANGE mail activity make sure that you have enabled ISBODYHTML so that only the mail with html enabled or included will be taken and gives us the list of mailmessges.
Then use FOR EACH activity to iterate through each mailmessage and inside the loop use a IF condition like this
item.Body.ToString.Contains(".png") or item.Body.ToString.Contains(".jpg")

this will check whether the mail html body has IMAGE in it or not, because so far we have checked only the html first but that doesnt mean whether it could be a html table or a image along the mail body. This will validate whether its a image or not.

or

if you are not using GET EXCHANGE mail activity and using normal mail activity,
it wont have ISBODYHTML property.
so to validate whether the mail body has html tags in it or not then get the list of mailmessage as a variable
then use a FOR EACH activity and pass the above variable and inside the loop use a ASSIGN activity
str_encodingName = item.BodyEncoding.EncodingName

this will give us a encoding name as “utf-8”
–use a IF condition and check whether the str_EncodingName has utf-8 in it or if its a plain text then it will have as “us-ascii”

–if the condition is true it will go to THEN part where use another IF condition and as said in the previous method use .png as condition and check whether it is a image along mail body or not

–Then we could save the mail message with SAVE MAIL MESSAGE activity
hope this would help you

Cheers @deepak_raj

3 Likes

Thanks Palaniyappan … Its working

1 Like

Cheers @deepak_raj

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.