Saving Mail to a local folder

Hello Guys,

iam using a save mail messages activity but mails are saving in different format and i cant open it.

This is the code

This is the saved outlook message format.

@Gokul_Murali,

You didn’t provided the file extention. Make sure you are passing file extension .eml in FilePath property.

@ashokkarale

This is how i done. where do i add extension

@Gokul_Murali,

Pass it like this

in_Config("GeneralPath").ToString+Now.ToString("yyyy")
+"\"+Now.ToString("MMMM")+".eml"

@ashokkarale

Month folder is converted to mail format

Ok @Gokul_Murali. How you are naming the emails? just suffix “.eml” to that.

For example with mail subject as file name

in_Config("GeneralPath").ToString+Now.ToString("yyyy")
+"\"+Now.ToString("MMMM")+"\"+yourMailObject.Subject+".eml"

@ashokkarale

Iam getting an error like this

image

My code

@Gokul_Murali,

It’s because of the special characters in mail subject not allowed in file name by windows. We will have to clean the subject string first.

strCleanedSubject = System.Text.RegularExpressions.Regex.Replace(MailSubject, "[<>:""/\\|?*]", " ")

Now use the cleaned subject as file name like this

in_Config("GeneralPath").ToString+Now.ToString("yyyy")
+"\"+Now.ToString("MMMM")+"\"+strCleanedSubject+".eml"

Thank you @ashokkarale

1 Like

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