Sicos1977 / MsgKit

A .NET library to make MSG files without the need for Outlook
199 stars 55 forks source link

Rename attachment when open in Outlook #87

Closed AnilCM12 closed 2 years ago

AnilCM12 commented 2 years ago

Is there any way to Rename the attachment document. Now the attachment is showing the name saved on the path specified and need to over write the name.

Sicos1977 commented 2 years ago

What do you mean? That it gets the filename as attachment name?

AnilCM12 commented 2 years ago

I will explain

I have a document attached in my folder - D:\files with a name 12345.docx I am adding the attachment from the above path like ,

using (var email = new Email( new Sender("peterpan@neverland.com", "Peter Pan"), new Representing("tinkerbell@neverland.com", "Tinkerbell"), "Hello Neverland subject")) {

email.Attachments.Add(@"D:\files\12345.docx"); }

Then i will download the file in msg format and then open in Outlook. When i open in Outlook the attachment name is 12345.docx. But i need to rename the attachment something like 'document12345.docx'. Also i have some limitations for renaming the attachment saved in my folder D:\files and that's why renaming is required.

I am looking for something like email.Attachments.FileName = "document12345.docx"

Is that possible?