Click here to Skip to main content
15,892,927 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I need to add image as attachement from list not from disk.

Image from list:

List<Image> listImage = new List<Image>();

i` added the images to this list.
Image to add as attachement is:
listImage[1]

add as attachement to
... = new System.Net.Mail.Attachment(...


i`ve tried
System.Net.Mail.Attachment A1;
A1 = new System.Net.Mail.Attachment(listImage[1].....);
email.Attachments.Add(A1);


but can`t make it to work.

How can i fix it? I don`t want to make the file on disk and then add it as an attachement.
Is this even possible?
Posted

1 solution

Hi,

Have a look here:
Creating In-Memory Mail Attachments[^]
In the article, there's text converted to a byte array, but you can do that also with an image:
C# Image to Byte Array and Byte Array to Image Converter Class[^]
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900