首页 >后端开发 >php教程 >在PHP代码中发送邮件的简单示例

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

WBOY
WBOY原创
2016-07-25 08:45:42940浏览
  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


声明:
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系admin@php.cn