Ondrej

Ondrej

  • NA
  • 3
  • 0

Sending mail with attachment (Bitmap) from MemoryStream don't work

May 25 2009 12:12 PM
I don't kown why..., but when I adding attachment (Bitmap) from MemoryStream, it dosn't work, because I receive mail with picture, but it has 0 KB. (sorry, my bad english)

Here is my snippet code:
...
Bitmap bmp;
...
MemoryStream = new MemoryStream();
bmp.Save(memStream, ImageFormat.Jpeg);
...
ContentType contentType = new ContentType();
contentType.MediaType = MediaTypeNames.Image.Jpeg;
contentType.Name = "screen";

MailMessage mail = new MailMessage();
...
mail.Attachments.Add(new Attachment(memStream, contentType));
...
SmtpClient.Send(mail);

Answers (3)