PHPMailer发送邮件
时间:2021-07-01 10:21:17
帮助过:16人阅读
- require './class.phpmailer.php';
- $mail=new PHPMailer();
- $mail->ContentType="text/html";
- $mail->Encoding="base64";
- $mail->IsSMTP();
- $mail->Host="smtp.163.com";
- $mail->SMTPAuth=true;
- $mail->Username="test@163.com";
- $mail->Password="123456";
- $mail->SetFrom("test@163.com","test");
- $content=<<这是一封测试的邮件,请不要做过多的关注!
- EMAIL;
- $mail->Subject="邮件测试";
- $mail->AddAddress("test@qq.com","newMail");
- $mail->Body=$content;
- if($mail->Send()){
- echo "发送成功!";
- }else{
- echo "发送失败!".$mail->ErrorInfo;
- }
|
发送邮件, PHPMailer