i successfully writed an auto add attachment to email if the condition FileInfo.Exists is true as this:
if (filename.Exists)
{
message.Attachments.Add(new Attachment(path + @"\filefolder\filename.extension"));
}
I have a series of this codes to attach many attachments in line; my question is how to give a name to every attachment? Something like:
if (filename.Exists)
{
message.Attachments.Add(new Attachment(path + @"\filefolder\filename.extension"));
//here i would like to write code to assign a different name for each attachment
}
if (filename2.Exists)
{
message.Attachments.Add(new Attachment(path + @"\filefolder2\filename2.extension"));
//here i would like to write code to assign a different name for each attachment
}
Since many of these attachments has the same name.extension i would like to know the relative name of the original attachment instad of having multiple files with the same names in my received email.
Thanks for your help.