【问题标题】:Error sending email from local server从本地服务器发送电子邮件时出错
【发布时间】:2018-04-22 12:45:10
【问题描述】:

我正在尝试使用我的 gmail 帐户从我的本地 wamp 服务器(操作系统是 Windows 10)在 codeigniter 3 中测试一个简单的联系表单。我以前做过很多次,但现在我得到一个错误。我已经阅读了有关该主题的所有 Stack 线程,但它们只是告诉我做我已经在做的事情,但它不起作用。我已经联系了 Google,但他们也告诉我做我已经在做的事情。

我已经这样设置了我的控制器:

        $config = array(
            'protocol'=>'smtp',
            'smtp_host'=>'ssl://smtp.gmail.com',
            'smtp_port'=>465,
            'smtp_user'=>'username@gmail.com',
            'smtp_pass'=>'password',
            'mailtype'=>'text',
            'charset'=>'iso-8859-1',
            'smtp_timeout'=>'30',
            'crlf'=>'r\n',
            'newline'=>'r\n',
            'wordwrap'=>TRUE
        );
        $this->load->library('email',$config);

我相信 php.ini 配置正确。我已在我的 Gmail 帐户中打开“允许安全性较低的应用程序”,并且两步验证已关闭。但我仍然收到此错误:

220 smtp.gmail.com ESMTP b36sm5736977edd.67 - gsmtp

hello: 250-smtp.gmail.com at your service, [86.180.98.185]
250-SIZE 35882577
250-8BITMIME
250-AUTH LOGIN PLAIN XOAUTH2 PLAIN-CLIENTTOKEN OAUTHBEARER XOAUTH
250-ENHANCEDSTATUSCODES
250-PIPELINING
250-CHUNKING
250 SMTPUTF8

Failed to authenticate password. Error: 535-5.7.8 Username and Password not accepted. Learn more at 535 5.7.8 https://support.google.com/mail/?p=BadCredentials b36sm5736977edd.67 - gsmtp
Unable to send email using PHP SMTP. Your server might not be configured to send mail using this method.

User-Agent: CodeIgniter
Date: Thu, 9 Nov 2017 10:22:00 +0000
From: "Mike Heath" <msheath@btinternet.com>
Return-Path: <msheath@btinternet.com>
To: mike24heath@gmail.com
Subject: =?ISO-8859-1?Q?=43=6F=6E=74=61=63=74=20=4D=65=73=73=61=67=65?=
Reply-To: <msheath@btinternet.com>
X-Sender: msheath@btinternet.com
X-Mailer: CodeIgniter
X-Priority: 3 (Normal)
Message-ID: <5a042c4818341@btinternet.com>
Mime-Version: 1.0


Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: 8bit

我确信我的用户名/密码是正确的,因为我可以使用它们登录 gmail。可能出了什么问题?感谢任何想法。

【问题讨论】:

  • 无法使用 PHP SMTP 发送电子邮件。您的服务器可能未配置为使用此方法发送邮件。您还想从我们这里获得什么?
  • 我不明白为什么 - 它以前总是有效的。我可以提供什么信息?显示我的 php.ini 文件有帮助吗?看了好几遍都晕了!

标签: php codeigniter email gmail wamp


【解决方案1】:

我刚刚发现了测试邮件服务器工具,它是我所有电子邮件测试问题的完整答案。忘记 Sendmail、PHPMailer、Gmail 等 http://www.toolheap.com/test-mail-server-tool/

【讨论】:

    猜你喜欢
    • 2019-11-26
    • 2017-01-30
    • 2013-12-18
    • 2017-05-19
    • 1970-01-01
    • 2018-03-15
    • 2014-04-19
    • 2015-09-10
    • 2016-01-02
    相关资源
    最近更新 更多