繁体   English   中英

如何使用phpmailer将脚本添加到邮件发送?

[英]How do I add script to the mail send using phpmailer?

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文件

你不能。 嗯,你可以,但它不会工作。 我不知道任何允许在邮件中运行javascript的电子邮件客户端(包括gmail等网络客户端)。 许多人也垃圾CSS,所以你真的不走运。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM