Mail.attachment question

DateTime.Parse(mail.Headers(“Date”)).ToString(“ddMMyyyy”) = Now.ToString(“ddMMyyyy”) And mail.attachments.ToString.Contains(Config(“Hyundai_ICICI_Sub2”).ToString)

how to edit this so that i can check the attachment name with the same code then attachment should get downloaded to respective folder.

Hi @taruna.a

Try the below one,

DateTime.Parse(mail.Headers("Date")).ToString("ddMMyyyy") = Now.ToString("ddMMyyyy") andalso mail.Attachments.AsEnumerable().Any(Function(X) X.Name.Contains(Config("Hyundai_ICICI_Sub2").ToString))

Hope it helps!!

its taking all the attachments including images as well.

Yes it will take one by one attachment in the mail and check the Hyundai_ICICI_Sub2 present in the name of attachment or not. If you want to filter with pdf, image or any files. Let me know… @taruna.a

Hope you understand!!

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