当前位置:Gxlcms > PHP教程 > 在PHP代码中发送邮件的简单示例

在PHP代码中发送邮件的简单示例

时间:2021-07-01 10:21:17 帮助过:12人阅读

  1. include("class.phpmailer.php");
  2. $mail = new PHPMailer();
  3. $mail->From = 'your email address@.com';
  4. $mail->FromName = 'HTML Blog';
  5. $mail->Host = 'host name';
  6. $mail->Mailer = 'smtp';
  7. $mail->Subject = 'subject';
  8. $mail->IsHTML(true);
  9. $body = 'Hello
    How are you ?';
  10. $textBody = 'Hello, how are you ?';
  11. $mail->Body = $body;
  12. $mail->AltBody = $textBody;
  13. $mail->AddAddress('reciepents full email address');
  14. if(!$mail->Send())
  15. echo 'There has been a mail error !';

发送邮件, PHP

人气教程排行