Image is not displaying in email template on 2nd time forward

Posted by Don on Stack Overflow See other posts from Stack Overflow or by Don
Published on 2012-09-29T09:36:35Z Indexed on 2012/09/29 9:37 UTC
Read the original article Hit count: 191

Filed under:
|
|
|
|

Good day Friends,

I've a mass mailing program with simple mail templates (HTML and few Images). I've a problem with image display. My clients are not getting images in the mail. Sometimes they get a mail with all the images, But if they forward the same email to someone else, they can’t get the images in forwarded mail.

I really don’t know what’s happening with the approach., most of the cases the 2nd time forwarded mail is not showing the images properly.

For example, consider I send a mail to client A,

Here, Client A will get a mail with Images. Further, If Client A forward the same message to Person B then Person B is not getting Images in the Forwarded email. I’m using the following Approach to Embed an image in the mail template:

StringBuilder sb = new StringBuilder(" <some html content> <img src=\"cid:main.png\"  alt=\"\" border=\"0\" usemap=\"#Map\"> </html content ends here>");

Attachment imgMain = new Attachment(Server.MapPath("main.png"));
imgMain.ContentId = "main.png";
MailMessageObject.Attachments.Add(imgMain);

Instead of attachment, I tried bypassing the Image path from server directly. Something like as follows:

StringBuilder sb = new StringBuilder(" <some html content> <img src=\"www.mydomain.com/images/main.png\"  alt=\"\" border=\"0\" usemap=\"#Map\"> </html content ends here>");

But, result is same, Please help to resolve this problem

© Stack Overflow or respective owner

Related posts about c#

Related posts about ASP.NET