+1 vote

how to load inline images without storing in Disk.
We want to load the inline images in the byte array.

by

1 Answer

0 votes
 
Best answer

Both MailBuilder.AddAttachment and MailBuilder.AddVisual metods have overrides that take byte array as a parameter:

MimeData att = builder.AddAttachment(new byte[]{ (byte)'A'});
MimeData visual= builder.AddVisual(new byte[] {1,2,3});

Please note that as you don't pass file name anywhere, content-type is not recognized and file name is not set. You should do that manually:

att.FileName = "report.txt";
att.ContentType = ContentType.TextPlain;

visual.FileName = "image.jpg";
visual.ContentType = ContentType.ImageJpeg
by (301k points)
...