Smtp Php mailer无法在webmail上发送邮件
我没有在我的网络邮件上收到任何邮件,但如果我把gmail凭据放进去,我会收到邮件Smtp Php mailer无法在webmail上发送邮件,smtp,phpmailer,webmail,Smtp,Phpmailer,Webmail,我没有在我的网络邮件上收到任何邮件,但如果我把gmail凭据放进去,我会收到邮件 $mail = new PHPMailer(); // Set up SMTP $mail->IsSMTP(); // Sets up a SMTP connection $mail->SMTPAuth = true; // Connection with the SMTP does require authorization $m
$mail = new PHPMailer();
// Set up SMTP
$mail->IsSMTP(); // Sets up a SMTP connection
$mail->SMTPAuth = true; // Connection with the SMTP does require authorization
$mail->SMTPSecure = "ssl"; // Connect using a TLS connection
$mail->Host = "mail.gmail.com"; //Gmail SMTP server address
$mail->SMTPDebug = 2; // enables SMTP debug information (for testing)
// 1 = errors and messages
// 2 = messages only
$mail->SMTPAuth = true;
$mail->Port = 465; //Gmail SMTP port
$mail->Encoding = '7bit';
// Authentication
$mail->Username = "admin@example.com"; // Your full address
$mail->Password = "password"; // Your password
// Compose
$mail->SetFrom($_POST['emailid'], $_POST['fullname']);
$mail->AddReplyTo($_POST['emailid'], $_POST['fullname']);
$mail->Subject = "New Contact Form Enquiry"; // Subject (which isn't required)
$mail->MsgHTML($message);
// Send To
$mail->AddAddress("recipientemail@gmail.com", "Recipient Name"); // Where to send it - Recipient
$result = $mail->Send(); // Send!
$message = $result ? 'Successfully Sent!' : 'Sending Failed!';
unset($mail);
我已经尝试了10次,但在gmail上我收到了邮件,但在webmail上没有您正在使用
SMTPSecure=“ssl”
和Port=587
。这是行不通的,如果您费心将代码建立在其他地方发现的一些破损、过时的东西之上,您就会知道这一点
至少你应该将
SMTPSecure=“tls”
与Port=587
一起使用,然后通过跟进。发生的错误好友我已经尝试使用465端口,不要发布你知道错误的代码。它只是浪费了每个人的时间。但不是在我的域邮件上,所以启用调试输出并查看它在做什么它没有显示任何错误只是显示2xx系列,所以没有任何错误,但我没有收到任何邮件,但如果你想,我可以为你发布它