首先,需要下载


下载地址:https://github.com/


下面给出程序:这里使用qq邮箱进行测试,需要去邮箱里面

设置=》账户=》POP3/IMAP/SMTP/Exchange/CardDAV/CalDAV服务中

勾选POP3/SMTP服务。


SMTPDebug = 2;  $mail->Host = "smtp.qq.com";  $mail->Port = "465";    $mail->SMTPSecure = "ssl";  $mail->SMTPAuth = true;  $mail->Username = "470356072";//username  $mail->Password = "******";//repalce your password  $mail->AddReplyTo("[email protected]", "网络");  $mail->AddAddress('470356072@qq.com');  $mail->SetFrom("[email protected]", "网络");  $mail->IsHTML(false);  $mail->Subject = "测试邮件";  $mail->MsgHTML("这是一封测试邮件!");  $mail->Send();  if($mail->Send()){      echo "success";    } else {    echo "false";   }?>
登录后复制



09-19 05:14