Embedding an HTML Image in a mail? -


i have requirement have embed image in mail , when user click on image redirect him new site. have no idea should provide in image src. possible through html. require guidance. thanks.

this trial html

<html> <head> </head> <title>trial</title> <body bgcolor="#ffffff" leftmargin="0" topmargin="0" marginwidth="0" marginheight="0"> <center> <table width="900" border="0" cellpadding="0" cellspacing="0">     <tr>         <td><a href="siteaddr"> <img style="float:left;" src="myimage.jpg" width="900" height="356" alt="my image" border="0" /></a></td>     </tr>  </table> </center> </body> </html> 

inline embedding (base64 encoding)

inline embedding more simple, because don’t have roll own emails , dig around in mime use it.

embedding image in email first requires have version of said image base64 encoded string. there lots of web based tools this, such imagetobase64converter web coder tools.

once image encoded, jump template, or whatever html you’re sending out, , embed using standard html image tag:

<img alt="my image" src="data:image/jpeg;base64,/9j/4s/+rxhpzgaatu0akgaaaagacaesaamaenkdz5u8/61a+x...more encoding" /> 

then you’re done! send away.

pros

much simpler achieve faster requires less deep dive mime , application code

cons

can increase size of emails if use more 1 image blocked default in many webmail services blocked in outlook

references: "sendgrid blog - embedding images"


external reference link

link image site.

<img src="http://this-is-a-url.com/this-is-an-image.jpg" /> 

Comments

Popular posts from this blog

c++ - No viable overloaded operator for references a map -

java - Custom OutputStreamAppender not run: LOGBACK: No context given for <MYAPPENDER> -

java - Cannot secure connection using TLS -