在PHP代码中发送邮件的简单示例
时间:2021-07-01 10:21:17
帮助过:12人阅读
- include("class.phpmailer.php");
- $mail = new PHPMailer();
- $mail->From = 'your email address@.com';
- $mail->FromName = 'HTML Blog';
- $mail->Host = 'host name';
- $mail->Mailer = 'smtp';
- $mail->Subject = 'subject';
- $mail->IsHTML(true);
- $body = 'Hello
How are you ?'; - $textBody = 'Hello, how are you ?';
- $mail->Body = $body;
- $mail->AltBody = $textBody;
- $mail->AddAddress('reciepents full email address');
- if(!$mail->Send())
- echo 'There has been a mail error !';
|
发送邮件, PHP