Home > Backend Development > PHP Tutorial > Simple example of sending mail in PHP code

Simple example of sending mail in PHP code

WBOY
Release: 2016-07-25 08:45:42
Original
912 people have browsed it
  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


source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template