How to embed an Image Stream to MailMessage

后端 未结 5 656
青春惊慌失措
青春惊慌失措 2020-12-09 10:03

I\'m having some difficulty embedding an image from the Properties.Resources to a MailMessage, currently the image does not show in the email i receive.

I have succe

5条回答
  •  春和景丽
    2020-12-09 10:58

    Bitmap b = new Bitmap(Properties.Resources.companyLogo);
    MemoryStream logo = new MemoryStream();
    b.Save(logo, ImageFormat.Jpeg);
    

    After you do the save, you have to "seek" the MemoryStream back to the start.

    logo.Position = 0;
    

提交回复
热议问题