PHP中的邮件代码:
$mail->isHTML(true); // Set email format to HTML
$mail->Subject = 'Training Program';
$mail->Body = "<html><head><script type = "."text/javascript"." "."src = "."pgm_mgmt.js"."></script>Dear<b> ".$trainername[$i].","."</b>"."<br><br>I'd like to know if you can attend the "."<b>".$trainerpgmname."</b>"." held at "."<b>".$trainercompany."</b>"." on "."<b>".$trainerdate."</b>"."<br><br>You can either accept or reject the request by clicking the Accept or Reject buttons below <br>"."<button"." "."name = ".$trainerid[$i]." "."value = ".$accept." "."onclick = accept(".$trainerid[$i].")".">Accept</button>"." "."<button"." "."name = reject".$trainerid[$i]." "."value = ".$reject.">Reject</button>";
$mail->AltBody = 'This is the body in plain text for non-HTML mail clients';
我应该如何添加脚本文件?此外,如何为按钮添加“id”,为“接受”和“拒绝”按钮添加“onclick”?请告诉我如何在点击邮件中的按钮
时将值传递给外部javascript文件答案 0 :(得分:2)
你做不到。嗯,你可以,但它不会工作。我不知道任何允许在邮件中运行javascript的电子邮件客户端(包括gmail等网络客户端)。很多人也把垃圾归咎于CSS,所以你真的不走运。