如何使用PHP在邮件功能中发送jquery?

时间:2011-06-10 04:51:56

标签: php mysql

我必须使用jquery工具提示发送邮件中的html。 html工作正常,但jquery工具提示没有显示HTML。我的代码是

require_once("config.php");

$to= "something@yahoo.com";
$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: sales@murreehotels.net"."\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");
}

3 个答案:

答案 0 :(得分:1)

简短的回答是你不能。邮件客户端剥离了JS。在一些客户端中包含外部样式表几乎是不可能的,更不用说JS

答案 1 :(得分:1)

电子邮件客户端通常会删除或不处理JavaScript,并且有充分的理由。

坚持使用纯HTML和适用于大多数邮件客户端的CSS子集。

答案 2 :(得分:1)

电子邮件客户端不会解析/执行JavaScript。如果他们这样做,就会导致各种令人不快的安全问题。你想要实现的目标不可能是我的朋友。