0

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!

rory.ap
  • 34,009
  • 10
  • 83
  • 174
Timon
  • 1,003
  • 1
  • 9
  • 38
  • Aspose is very buggy. Post to their support forum and send them some sample code to show what's happening. Make sure you don't give them your key file. Also, it's best to zip your project up and attach as one file. – rory.ap Aug 05 '16 at 12:35
  • Do you know other projects that i could use to create oft files ? – Timon Aug 05 '16 at 12:45

1 Answers1

0

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.