0 votes

Hello,

we are using limilabs mail components in our software for a few months.
Now we have the problem, that sometimes an email has attachments with the same filename (e.x. some.pdf, some.pdf) but the content of the file is different.

Now I want to know if it`s possible to rename the attachment files before saving the attachments to a local folder. So I want to rename the files only if there are more than 1 file with the same file name. If there is a unique file name the file shoud not be renamed.

Thanks for a solution!

Regards!

by (350 points)
retagged by

1 Answer

0 votes

You can specify any filename you want when you save the attachment:

byte[] eml = ...;
IMail mail = new MailBuilder().CreateFromEml(eml);
MimeData att = mail.Attachments[0];
att.Save("c:\\any_file_name_you_want.pdf");
by (301k points)
...