wou*_*_be 1 php email phpmailer
在过去的两个小时里,我一直在网上看看是否有其他人遇到过这个问题,而且看起来很多,但是没有一个答案对我有用.
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";
Run Code Online (Sandbox Code Playgroud)
我已经尝试过PHPMailer的几乎所有设置,但无法弄清楚仍然存在什么问题,我需要处理任何服务器设置吗?
我也尝试过普通的php mail()函数,但这也不是发送邮件,虽然使用Drupal表单时它只是发送一封电子邮件.
小智 10
首先,您必须配置正确的服务器以发送电子邮件(请参阅gmail.com):
SMTP server address: smtp.gmail.com
SMTP user name: Your full Gmail address (e.g. example@gmail.com)
SMTP password: Your Gmail password
SMTP port: 465 or 587
SMTP TLS/SSL required: yes
Run Code Online (Sandbox Code Playgroud)
在PHPMailer中:
$mail->SMTPAuth = true; // There was a syntax error here (SMPTAuth)
$mail->SMTPSecure = 'tls';
$mail->Host = "smtp.gmail.com";
$mail->Mailer = "smtp";
$mail->Port = 465;
$mail->Username = "YOU@gmail.com";
$mail->Password = "YOUR_GMAIL_password";
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
41118 次 |
| 最近记录: |