我已经检查了我的 wamp 服务器是否使用了 openssl,并且正在检查。但是我的代码有什么问题?
$mail = new PHPMailer(true);
$body = 'THIS IS YOUR USERNAME:'.$row['username'].' PASSWORD: '.$row['password'].'\n PLEASE DELETE THIS MESSAGE AFTER YOU READ THIS';
$mail->SMTPDebug = 1;
$mail->IsSMTP(); // tell the class to use SMTP
$mail->SMTPAuth = true; // enable SMTP authentication
$mail->Port = 587; // set the SMTP server port
$mail->SMTPSecure = 'tsl';
$mail->Host = 'smtp.gmail.com';
$mail->Username = "dan.villarea22@gmail.com"; // SMTP server username
$mail->Password = "password"; // SMTP server password
$mail->AddReplyTo("system@dvts.com","ADMIN");
$mail->From = "system@dvts.com";
$mail->FromName = "SYSTEM";
$to = "dan.villareal22@gmail.com";
$mail->AddAddress($to);
$mail->Subject = "First PHPMailer Message";
$mail->AltBody = "To view the message, please use an HTML compatible email viewer!"; // optional, comment out and test
$mail->WordWrap = 80; // set word wrap
$mail->MsgHTML($body);
$mail->IsHTML(true); // send as HTML
$mail->Send();echo 'Message has been sent.';