Email not saving when it has special character like ":" or "." or "-"


Can somebody help me this piece of code to save email. Currently I am able to save all emails with their subject line in .eml format however the code fails when the subject line has a special character like “.” or “-” or “:”. This is because my code assigns value to variable (emailsubject = mail.subject.tostring) and saves email using the value in variable(path+emailsubject)


You have to use the replace method to remove all the special characters. It can get quite lengthy though so if you find a better way, please let me know!

Hi Ken,

Thanks for your reply! I may have to take this approach as I would need to search emails with subject line in future.