Currently we stored email text in db table and when we send an email, we query the db get the email text, do an HTML Encode and send email. But now we need to send Images in the email. What I did was stored the image in project file and stored the image location as tag in email text in db table. But its not working, any ideas on how should i do this. I need to insert image in middle of text. This is how we store html email in db table. As html is being parsed I copied it in comments section.
Asked
Active
Viewed 155 times
0
-
YOUR EMAIL TEXT
– user1663996 Aug 07 '13 at 12:59
2 Answers
3
Pass your body to an html form and allowhtml(true) while sending email like this
MailMessage mail = new MailMessage();
SmtpClient SmtpServer = new SmtpClient();
SmtpServer.Host = Host;
mail.IsBodyHtml = true;
mail.From = new MailAddress(FromEmail);
mail.To.Add(ToEmail);
mail.Body = MailBody;
such that MailBody is String.Format("{0} with < img href='{1}' />",email,imagesrc);
{0} will be replaced by email
{1} will be replaced by imagesrc

Ahmed Alaa El-Din
- 1,813
- 1
- 16
- 19
1
you have to upload your picture to a webserver and set the src of the image to the absolute path!
<img src="http://www.myuploaded.com/image.jpg" />
if you cannot do that look at this post:

Community
- 1
- 1

Nikolaj Zander
- 1,270
- 9
- 13