How to add attachments to .oft file with Aspose

266 Views Asked by At

I want to create a .oft file with C# . The oft file needs to have a html body and attachments.

I found that i should be able to do this using Aspose. However when i run my code the attachments never get added.

( They are added to the AttachmentCollection but aren't shown when the .oft file is opened in outlook. The oft file does get 20x as large so i presume the raw attachment data is added. )

MailMessage message = new MailMessage();

var attachmentGif = new Attachment(@"C:\inetpub\wwwroot\IntranetKbs\Website\Email logos\" + language + @"\KBSFRB_logo_" + language + @".gif");
var attachmentEps = new Attachment(@"C:\inetpub\wwwroot\IntranetKbs\Website\Email logos\" + language + @"\KBSFRB_logo_" + language + @".eps");

message.Attachments.Add(attachmentGif);
message.Attachments.Add(attachmentEps);

Below you can see some information about the attachments after they are added to the AttachmentList.

enter image description here enter image description here

If you know what could cause this, or know an other way to create .oft files you help and comments would be greatly appreciated!

1

There are 1 best solutions below

0
On

If you have to display the images in message's HTML body, you need to include them as linked resource rather than regular attachments. This should serve your requirements of adding image to the message body and display it in MS Outlook.

Note: I work with Aspose as Developer Evangelist.