PHP-Mailer代码

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了PHP-Mailer代码相关的知识,希望对你有一定的参考价值。

Advance Mail function using php Mailer Class
  1. <?php
  2. require("class.phpmailer.php");
  3.  
  4. $mail = new PHPMailer();
  5.  
  6. $mail->IsSMTP(); // send via SMTP
  7. $mail->Host = "smtp.domain.com"; // SMTP servers
  8. $mail->SMTPAuth = true; // turn on SMTP authentication
  9. $mail->Username = "[email protected]"; // SMTP username
  10. $mail->Password = "password"; // SMTP password
  11.  
  12. $mail->From = "[email protected]";
  13. $mail->FromName = "Name";
  14. $mail->AddAddress("[email protected]","Name");
  15. $mail->AddReplyTo("[email protected]","Your Name");
  16.  
  17. $mail->WordWrap = 50; // set word wrap
  18.  
  19. $mail->Ishtml(true); // send as HTML
  20.  
  21. $mail->Subject = "Here is the subject";
  22. $mail->Body = "This is the <b>HTML body</b>";
  23. $mail->AltBody = "This is the text-only body";
  24.  
  25. if(!$mail->Send())
  26. {
  27. echo "Message was not sent <p>";
  28. echo "Mailer Error: " . $mail->ErrorInfo;
  29. }
  30.  
  31. echo "Message has been sent";
  32.  
  33. ?>

以上是关于PHP-Mailer代码的主要内容,如果未能解决你的问题,请参考以下文章

微信小程序代码片段

谷歌浏览器调试jsp 引入代码片段,如何调试代码片段中的js

VSCode自定义代码片段——CSS选择器

VSCode自定义代码片段——.vue文件的模板

VSCode自定义代码片段6——CSS选择器

VSCode自定义代码片段——声明函数