PHPMailer SMTP配置 [英] PHPMailer SMTP configuration

查看:226
本文介绍了PHPMailer SMTP配置的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在过去的2个小时里,我一直在网上寻找是否有其他人遇到过此问题,而且似乎有很多问题,机器人没有任何答案对我有用.

For the past 2 hours I've been looking online to see if any other people encountered this problem, and it seems a lot has, bot none of the answers are working for me.

SMTP -> FROM SERVER:220 mx.google.com ESMTP vq7sm928004oeb.13 
SMTP -> FROM SERVER: 250-mx.google.com at your service, [50.57.114.141] 250-SIZE 35882577 250-8BITMIME 250-STARTTLS 250 ENHANCEDSTATUSCODES 
SMTP -> FROM SERVER:220 2.0.0 Ready to start TLS 
SMTP -> FROM SERVER: 250-mx.google.com at your service, [50.57.114.141] 250-SIZE 35882577 250-8BITMIME 250-AUTH LOGIN PLAIN XOAUTH XOAUTH2 250 ENHANCEDSTATUSCODES 
SMTP -> FROM SERVER:530-5.5.1 Authentication Required. Learn more at 530 5.5.1 http://support.google.com/mail/bin/answer.py?answer=14257 vq7sm928004oeb.13 
SMTP -> ERROR: MAIL not accepted from server: 530-5.5.1 Authentication Required. Learn more at 530 5.5.1 http://support.google.com/mail/bin/answer.py?answer=14257 vq7sm928004oeb.13 
The following From address failed: my@email.com

$mail->IsSMTP();
$mail->SMTPDebug = 2;
$mail->SMPTAuth = true;
$mail->SMTPSecure = 'tls';
$mail->Host = "smtp.gmail.com";
$mail->Mailer = "smtp";
$mail->Port = 587;
$mail->Username = "my@email.com";
$mail->Password = "password";

我已经尝试了几乎所有的PHPMailer设置,但无法弄清楚出了什么问题,我需要处理任何服务器设置吗?

I've tried almost every setting for PHPMailer, but can't figure out what's still going wrong, are there any server settings I need to take care of?

我也尝试了普通的php mail()函数,但这也不发送邮件,尽管使用Drupal表单时它只是发送电子邮件.

I also tried the normal php mail() function, but that's not sending mail either, although when using Drupal forms it just sends an email.

推荐答案

仅注意到我在$mail->SMPTAuth = true;行中键入了SMTP错误,纠正了此问题,从而解决了我的问题.

Just noticed I typed SMTP wrong in this line $mail->SMPTAuth = true;, correcting this solved my problem.

这篇关于PHPMailer SMTP配置的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆