Click here to Skip to main content
15,888,351 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I want to add inline image with html code for sending email in C#,,
How to add image along with
Posted

The easiest way is to send the email as HTML and embed a img tag into it:
HTML
<img style="border: none;" src="http://www.Software-Matters.com/Resources/Images/Logos/SoftwareMattersH32.png" width="99" height="32" alt="Software Matters" />
 
Share this answer
 
Comments
JawadHafiz 24-Oct-11 11:54am    
not working
OriginalGriff 24-Oct-11 11:58am    
Check your link URL: that was taken directly from my standard email template file and it works!
if you need to send an image which is not available via URL, you can embed it directly
HTML
<img src="data:image/gif;base64,..." />
where "..." is the base64-encoded image. This may not work with all email clients and is limited to small images by the maxlength of a tag and its attributes (see rfc2397[^] for further info).

Cheers
Jürgen
 
Share this answer
 
My code
<pre lang="c#"> message.Body += "<table width='500' border='0' cellpadding='0' cellspacing='0'><tr><td width='185' height='60' style='font-family:Arial, Helvetica, sans-serif; font-size:26px; color:#fff; font-weight:bold;'><img style='border: none;' src='~/Blue/Images/logo.gif' alt='CanvasDaddy' /></td><td align='center' style='font-size:14px; color:#fff;'>Thank you for ordering from CanvasDaddy.com!</td></tr>";

</pre>>


this is'nt work
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900