我有以下代码将 jpeg 附加到电子邮件中。
System.Net.Mime.ContentType contentType = new System.Net.Mime.ContentType();
contentType.MediaType = System.Net.Mime.MediaTypeNames.Image.Jpeg;
contentType.Name = "screen";
Attachment screenCapture = new Attachment(imageStream, contentType);
//this next line works, I checked the image on the hard drive so I know the jpeg is ok
File.WriteAllBytes("c:\\somecoolimage.jpeg", imageStream.ToArray());
mail.Attachments.Add(screenCapture);
smtp.Send(mail);
但是,当我收到电子邮件中带有附件的电子邮件时,它有 0 个字节。我在这里做错了什么?