2011-06-10 76 views
0

我必須發送郵件的HTML與jQuery的工具提示。該html工作正常,但jQuery的工具提示不顯示與HTML。我的代碼是如何發送jQuery郵件功能使用PHP?

require_once("config.php"); 

$to= "[email protected]"; 
$subject= "Todays follow up status from Murree Hotels Website"; 

$query= "select * from honymoon_enquries WHERE arrival_date BETWEEN DATE(NOW()) AND DATE(NOW())+7 order by arrival_date"; 

$res=mysql_query($query); 

$message = "<strong>Hi Admin <br><br> </strong>"; 

$message .= "<strong> Here is the list of all clients coming in next seven(7) days.<br><br> </strong>"; 

$message .=" 
<link rel='stylesheet' href='jquery-tooltip/jquery.tooltip.css'/> 
<script src='jquery-tooltip/lib/jquery.js' type='text/javascript'></script> 
<script src='jquery-tooltip/lib/jquery.bgiframe.js' type='text/javascript'></script> 
<script src='jquery-tooltip/lib/jquery.dimensions.js' type='text/javascript'></script> 
<script src='jquery-tooltip/jquery.tooltip.js' type='text/javascript'></script> 

<script src='jquery-tooltip/demo/chili-1.7.pack.js' type='text/javascript'></script> 

<script type='text/javascript'> 
$(function() { 
$('#right *').tooltip({ 
    track: true, 
    delay: 100, 
    showURL: false, 
    extraClass: 'right' 
}); 

$('#right2 a').tooltip({ showURL: false, positionLeft: true }); 

$('#block').click($.tooltip.block); 

}); 
</script> 
<table width='100%' cellpadding='0' cellspacing='0' style='margin-top:5px;margin-bottom:5px;'> 
    <tr> 
    <td> 
     <div style='border:1px solid #CCCCCC; padding:10px; padding-top:5px; text-align:center'> 
<div>   
<table width='100%' border='1' cellpadding='5' cellspacing='3'> 
<tr> 
<th>Name</th> 
<th>Email</th> 
<th>Phone</th> 
<th>Arival_Date</th> 
<th>Adminfeedback</th> 
</tr> 
";  
while ($resresult = mysql_fetch_array($res)) { 

$message .=" 
<tr BGCOLOR='99CCFF'> 
<td>".$resresult['client_name']."</td> 
<td>".$resresult['client_email']."</td> 
<td>".$resresult['client_phone']."</td> 
<td>".$resresult['arrival_date']."</td> 
<td align='left' title='".$resresult['adminfeedback']."' style='cursor:help;'>".$resresult['adminfeedback']."</td> 
";  
} 
$message .="</table></div></td> </tr> </table></div>" ; 


$headers = "From: [email protected]"."\r\n"; 
$headers .= 'MIME-Version: 1.0' . "\r\n"; 
$headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n"; 


if (!mail($to,$subject,$message,$headers)) { 
    die("Message sending failed"); 
} 
+2

你想要一個JavaScript工具提示在電子郵件?簡短的回答 - 你不能。如果電子郵件客戶端允許js,那麼這是一個很大的安全問題,所以他們不會。 – 2011-06-10 04:55:49

+0

不行。在電子郵件中的JavaScript是不行的。 – jpea 2011-06-10 04:57:44

+0

他可以,電子郵件可以包含HTML和JavaScript – Dani 2011-06-10 04:58:13

回答

1

簡短的回答是你不能。郵件客戶端去掉JS。幾乎不可能在某些客戶端中包含外部樣式表,更不用說JS

+0

嗨所以我們不發送郵件功能jquey?:)) – 2011-06-10 04:59:25

+0

@shoaibakhunzada yup。你不發送它。你應該閱讀這篇關於HTML電子郵件的良好指導的文章:http://www.campaignmonitor.com/design-guidelines/ – JohnP 2011-06-10 05:00:25

1

電子郵件客戶端通常會剝離或不處理JavaScript,這是很有原因的。

只需使用純HTML和適用於大多數郵件客戶端的CSS子集即可。

1

電子郵件客戶端不會解析/執行JavaScript。如果他們這樣做了,會導致各種令人不快的安全問題。你想要實現的是我的朋友不可能實現的。

+0

好了@jahufar謝謝你...... :) – 2011-06-10 05:09:54