/ Published in: C#

Como insertar imgenes en un envio via email en ASP.NET
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
try { mail.Subject = "Test with Image"; string Body = <b>Welcome to codedigest.com!!</b><br><BR>Online resource for .net articles.<BR><img alt=\"\" hspace=0 src=\"cid:imageId\" align=baseline border=0 >"; AlternateView htmlView = AlternateView.CreateAlternateViewFromString(Body, null, "text/html"); LinkedResource imagelink = new LinkedResource(Server.MapPath(".") + @"\codedigest.png", "image/png"); imagelink.ContentId = "imageId"; imagelink.TransferEncoding = System.Net.Mime.TransferEncoding.Base64; htmlView.LinkedResources.Add(imagelink); mail.AlternateViews.Add(htmlView); smtp.DeliveryMethod = SmtpDeliveryMethod.PickupDirectoryFromIis; smtp.Send(mail); } catch (Exception ex) { Response.Write(ex.Message); }
URL: http://www.codedigest.com/Articles/ASPNET/95_Sending_Email_using_C__and_ASPNet_20.aspx
Comments
