Revision: 49523
Initial Code
Initial URL
Initial Description
Initial Title
Initial Tags
Initial Language
at July 23, 2011 09:29 by derebus
Initial Code
try { MailMessage mail = new MailMessage(); mail.To.Add("[email protected]"); mail.From = new MailAddress("[email protected]"); 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); SmtpClient smtp = new SmtpClient(); smtp.DeliveryMethod = SmtpDeliveryMethod.PickupDirectoryFromIis; smtp.Send(mail); } catch (Exception ex) { Response.Write(ex.Message); }
Initial URL
http://www.codedigest.com/Articles/ASPNET/95_Sending_Email_using_C__and_ASPNet_20.aspx
Initial Description
Como insertar imgenes en un envio via email en ASP.NET
Initial Title
Sending different Email types with ASP.Net
Initial Tags
email, image, mail, Net, aspnet
Initial Language
C#