1

I am using the below partial code to send email message to our client like News letters.It sent correctly but i have a small problem for sending email. Now i post some images in HTML code. Image does not show in email message.Please help me to solve this issue..

This is my partial code:

    msg.To = wemail;
                            //msg.Bcc = "bcc email";
                            msg.BodyFormat = MailFormat.Html;
                            msg.Body = "<html xmlns='http://www.w3.org/1999/xhtml'><head><title>Untitled Document</title></head><body><table width='506' style='border-style:solid; border-radius:5px;' ><tr><td width='496'>  <img src='../images/logo1.jpg' alt='' width='508' /></td></tr><tr>  <td height='1px'><hr /></td></tr><tr style='border:0px; background:#6CF;'>  <td align='left' style='border-bottom:1px;'><p><b>Dear Team,</b></p>    <p><b>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;  This mail is to inform you ....</b></p>    <p><u><b>Note : </b></u></p>    <p><i>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;  ....&nbsp;</i>     </p>     <form action='http://xxx.in' method='post' target='_blank'>  <!--  <form id='form1' name='form1' method='post' action=''>-->      <b>      Please Click Here : </b>        <input type='submit' name='btn_submit' id='btn_submit' onclick='window.location.href='http://xxx.in'' value='Visit our 'Portal' ' />     </form><br /><br /></td></tr><tr style='border-top:#000'>  <td> <img src='../images/Untitled-2.gif' alt='' /></td></tr></table></body></html>";
jman
  • 11,334
  • 5
  • 39
  • 61
rom fernando
  • 71
  • 1
  • 5
  • 13

3 Answers3

0

You'll need absolute URLs for the images. If you have "../images/logo1.jpg" as the image URI, the email client won't know where to fetch it from. Upload the images to a web server and use "http://exam.ple/images/logo1.jpg" as the URL. If you do this, most clients will still not load external images automatically as that can be used for tracking, etc.

You can encode the email as multipart mime and embed the image in the email. See How to embed images in html email.

Community
  • 1
  • 1
jman
  • 11,334
  • 5
  • 39
  • 61
  • Now am using an intranet site.What i do this? – rom fernando Jul 24 '12 at 03:40
  • See the link I referred to. You need to do the equivalent from ASP.net. Perhaps this helps: http://www.asp.net/web-forms/videos/how-do-i/how-do-i-embed-an-image-in-an-email-with-aspnet – jman Jul 24 '12 at 03:41
0

You need to provide the absolute url of the image. Otherwise it won't be displayed.

Like

<img src="http://yoursite.com/imGges/image.jpg" />
Anuraj
  • 18,859
  • 7
  • 53
  • 79
0

you need to provide the entire url for the image and not just <img src='../images/logo1.jpg' alt='' width='508' />

instead provide exact path to .jpg file

and if you want to embed your mail, then you have to use 'cid' like <img src="cid:whatever"> The "src=cid:" part is required for the email client to recognize the tag as an embedded image, while the "whatever" part is the actual Content-Id of the LinkedResource image.

For more information you can look here : http://www.systemnetmail.com/faq/4.4.aspx

NG.
  • 5,695
  • 2
  • 19
  • 30
  • Now am using an intranet site.What i do this? – rom fernando Jul 24 '12 at 03:45
  • 1
    It doesn't matter whether you are using intranet site or not, the concept remains the same. Try using either http://www.asp.net/web-forms/videos/how-do-i/how-do-i-embed-an-image-in-an-email-with-aspnet or http://www.systemnetmail.com/faq/4.4.aspx – NG. Jul 24 '12 at 03:51