我想用php发送邮件,我的代码如下;
<?php
include 'class.phpmailer.php';
$mail = new PHPMailer();
$mail->IsSMTP();
$mail->SMTPAuth = true;
$mail->Host = 'smtp.gmail.com';
$mail->Port = 587;
$mail->Username = 'mertcankarayilan@gmail.com';
$mail->Password = '*******';
$mail->SetFrom($mail->Username, 'Pegasus Havayolları?');
$mail->AddAddress('mertcankarayilan@hotmail.com', 'mertcankarayilan');
$mail->CharSet = 'UTF-8';
$mail->Subject = 'Ekomak';
$content = 'mailde yazan';
$mail->MsgHTML($content);
if($mail->Send()) {
echo "<script>window.location.href='islem-basari.php#gosterb';</script>";
} else {
echo 'Mail gönderilirken bir hata oluştu: ' . $mail->ErrorInfo;
}
?>
我看到这样一个错误:
以下发件人地址失败:mertcankarayilan@gmail.com:不接受来自服务器的邮件
SMTP服务器错误: 5.7.0必须先发出STARTTLS命令。k6sm56314517eep.17-gsmtp
必须输入方法“TLS”:
$mail-