How to save only .pdf attachments from an email

Hi,

My process currently cycles through an email collection one at a time and downloads the email attachments. I have applied a .pdf to the filter in the SaveMailAttachments activity. The only problem is, when an attachment with a .jpg arrives it is producing an error. What is the best way to create an IF statement to check the attachment name ends in pdf please? The variable I am currently using is of “MailMessage” type so I’m guessing it would somehow need to initially need to be converted to a string to also interrogate?

Any help would be greatly appreciated.

Thanks.

Hi,

Do you mean SaveMailAttachment activity throw some exception if jpeg file is attached? Or later activity throw exception because filter doesn’t work?

I suppose the filter should be "\.(pdf|PDF)$" because of regular expression.
Can you try it?

Regards,

Yoichi

3 Likes

Thanks Yoichi!

1 Like

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