Search code examples
asp.nethtmlemailformatted

HTML Formatted Mail through ASP.net problem


i have used System.Web.Mail.MailMessage to send HTML Formatted message to an email id.

The email id is on gmail.com so mail has been received fine but Content has not been shown.

However if i see the mail in original shape it has the whole content the divs, images and all the stuff. but inbox don't show a single thing.

can any one explain the original problem?

    <html><!DOCTYPE html PUBLIC " -//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"><head>
<script type="text/javascript" language="javascript">
function PlayVid(Id, src) 
{
var val = VidPlayerShow(src); 
document.getElementById(Id).innerHTML = val; 
return false;
}
function VidPlayerShow(varID) 
{
var source = varID; 
var findex = 25; 
var lindex = source.indexOf('/', 26); 
var newSource = source.substring(26, lindex);
var newTag = '<embed src=http://www.youtube.com/v/' + newSource + '&autoplay=1 type=application/x-shockwave-flash width=500 height=400 allowFullScreen=true wmode=transparent></embed>';
return newTag;
}</script></head>
<body>New Hype Shared<br>
<table>
<tr><td align=left><a class='ContentLink' href=Contents.aspx?CID=N?FFMKMLFG6M>Joke</a><span style=font-size: 11px> by: </span><span>Chamman</span></td></tr><tr><td style=width: 500px; min-width: 500px><div>
<div id=div186> 
<img src=http://img.youtube.com/vi/xMfBRStbRvQ/default.jpg onclick='return PlayVid(parentNode.id,this.src)' /></div>
</div></td></tr>
<tr><td>
<table class=style1>
<tr>
<td id='td186' align=left width=50px><a id='btn186' onclick='return ShowhideShare(this.id,parentNode.id)' class='lnkbLike' style='color: #034af3; font-size: 10px' href=''>Share</a></td>
<td align=left width=200px><a id='lnkbLike186' onclick='return LikeIt(this.id)' href='#' style='font-size:9px'>Like it </a><span style='font-size:9px'> (0 people liked it)</span></td>
<td align=left width=200px><a id='lnkbSpam186' class='lnkbLike' onclick='return SpamIt(this.id)' href=''>This is Spam!</a></td><td></td></tr></table></td>
</tr>
<tr><td>
<div id='divCmntMain186'><table width=330px style='margin:0px 0px 0px 0px;padding:0px 0px 0px 0px;background-color: #F5F5F5; border: solid 1pt lightGray'><tr class='AccordianUp'><td>Comments</td>
<td align=right style=font-size:9px><a id='lnkComment186' class='lnkbLike' onclick='return NewComment(this.id)' href=''>New Comment</a></td></tr>
</table></div></td></tr>
<tr><td></td></tr></table> <br> by Chamman <a href=http://www.hyprate.com/Contents.aspx?CID=N?FFMKMLFG6M> Click Here to Follow </a> Regards, <br> The Hyprate Team</body></html></html>

This is basically the HTML which i am sending to the email address

Sorry for the Rough HTML! it is auto generated so i cant do anything!


Solution

  • If you post your raw message (using Gmail, click "show original") then that would be helpful. However, chances are you are using HTML that is getting eaten alive by the mail client.

    Don't use DIVs. You can use images, but it is up to the client to decide to display them or not.

    This table of compatible CSS features may also help you: http://www.campaignmonitor.com/css/

    Edit: I see you have posted your source code. Javascript... that most definitely will not execute.