【问题标题】:phpMailer email not sending gmail smtpphpMailer电子邮件不发送gmail smtp
【发布时间】:2014-10-19 13:50:12
【问题描述】:

我无法使用 gmail SMTP 发送电子邮件,这是我在 print_r 对象时得到的。

我对 phpMailer 属性的用户名和密码使用相同的 gmail 凭据,所以我确定我的凭据是正确的,但不知道为什么它不发送。

谢谢,感谢任何支持。

EMailer Object
(
    [pathViews:protected] => application.views.email
    [pathLayouts:protected] => application.views.email.layouts
    [_myMailer:EMailer:private] => PHPMailer Object
        (
            [Priority] => 3
            [CharSet] => UTF-8
            [ContentType] => text/html
            [Encoding] => 8bit
            [ErrorInfo] => SMTP Error: Could not authenticate.
            [From] => support@qelasy.com
            [FromName] => Qelasy Administrator
            [Sender] => 
            [Subject] => Qelasy Security PIN
            [Body] => Dear Parent,<br /><br />You have successfully registered for Qelasy Security System.<br /><br />Please use this PIN to activate your tablet: <b>34123</b>.<br /><br />Thank you for registering with Qelasy Security System.<br /><br />We value your participation.<br /><br />If you have any questions please call +33 6 9881 1914 or email us at help@qelasy.com.<br /><br />Thank You,<br />Qelasy Security Team
            [AltBody] => 
            [WordWrap] => 0
            [Mailer] => smtp
            [Sendmail] => /usr/sbin/sendmail
            [PluginDir] => 
            [ConfirmReadingTo] => 
            [Hostname] => 
            [MessageID] => 
            [Host] => smtp.gmail.com
            [Port] => 465
            [Helo] => 
            [SMTPSecure] => ssl
            [SMTPAuth] => 1
            [Username] => appmonkeydev@gmail.com
            [Password] => ********
            [Timeout] => 10
            [SMTPDebug] => 
            [SMTPKeepAlive] => 
            [SingleTo] => 
            [LE] => 

            [smtp:PHPMailer:private] => SMTP Object
                (
                    [SMTP_PORT] => 25
                    [CRLF] => 

                    [do_debug] => 
                    [do_verp] => 
                    [smtp_conn:SMTP:private] => Resource id #86
                    [error:SMTP:private] => 
                    [helo_rply:SMTP:private] => 250-mx.google.com at your service, [220.247.236.99]
250-SIZE 35882577
250-8BITMIME
250-AUTH LOGIN PLAIN XOAUTH XOAUTH2 PLAIN-CLIENTTOKEN
250-ENHANCEDSTATUSCODES
250-CHUNKING
250 SMTPUTF8

                )

            [to:PHPMailer:private] => Array
                (
                    [0] => Array
                        (
                            [0] => azraarshu@gmail.com
                            [1] => 
                        )

                )

            [cc:PHPMailer:private] => Array
                (
                    [0] => Array
                        (
                            [0] => yohan@appmonkeyz.com
                            [1] => Yohan Hirimuthugoda
                        )

                    [1] => Array
                        (
                            [0] => azraar@app-monkeyz.com
                            [1] => Azraar Azward
                        )

                )

            [bcc:PHPMailer:private] => Array
                (
                )

            [ReplyTo:PHPMailer:private] => Array
                (
                    [support@qelasy.com] => Array
                        (
                            [0] => support@qelasy.com
                            [1] => 
                        )

                )

            [all_recipients:PHPMailer:private] => Array
                (
                    [azraarshu@gmail.com] => 1
                    [yohan@appmonkeyz.com] => 1
                    [azraar@app-monkeyz.com] => 1
                )

            [attachment:PHPMailer:private] => Array
                (
                )

            [CustomHeader:PHPMailer:private] => Array
                (
                    [0] => Array
                        (
                            [0] => Cc
                            [1] =>  Yohan Hirimuthugoda <yohan@appmonkeyz.com>
                        )

                    [1] => Array
                        (
                            [0] => Cc
                            [1] =>  Azraar Azward <azraar@app-monkeyz.com>
                        )

                )

            [message_type:PHPMailer:private] => plain
            [boundary:PHPMailer:private] => Array
                (
                    [1] => b1_631af702e0f737dd5c11dcff55e1d8ee
                    [2] => b2_631af702e0f737dd5c11dcff55e1d8ee
                )

            [language:protected] => Array
                (
                    [provide_address] => You must provide at least one recipient email address.
                    [mailer_not_supported] =>  mailer is not supported.
                    [execute] => Could not execute: 
                    [instantiate] => Could not instantiate mail function.
                    [authenticate] => SMTP Error: Could not authenticate.
                    [from_failed] => The following From address failed: 
                    [recipients_failed] => SMTP Error: The following recipients failed: 
                    [data_not_accepted] => SMTP Error: Data not accepted.
                    [connect_host] => SMTP Error: Could not connect to SMTP host.
                    [file_access] => Could not access file: 
                    [file_open] => File Error: Could not open file: 
                    [encoding] => Unknown encoding: 
                    [signing] => Signing Error: 
                    [smtp_error] => SMTP server error: 
                    [empty_message] => Message body empty
                    [invalid_address] => Invalid address
                    [variable_set] => Cannot set or reset variable: 
                )

            [error_count:PHPMailer:private] => 1
            [sign_cert_file:PHPMailer:private] => 
            [sign_key_file:PHPMailer:private] => 
            [sign_key_pass:PHPMailer:private] => 
            [exceptions:PHPMailer:private] => 1
        )

)

从 Gmail 收到的电子邮件。

Hi appmonkey, 

We recently blocked a sign-in attempt to your Google Account [appmonkeydev@gmail.com]. 

Sign in attempt details
Date & Time: Tuesday, August 26, 2014 9:23:38 AM UTC 
Location: Colombo, Sri Lanka 

If this wasn't you
Please review your Account Activity page at https://security.google.com/settings/security/activity to see if anything looks suspicious. Whoever tried to sign in to your account knows your password; we recommend that you change it right away. 

If this was you
You can switch to an app made by Google such as Gmail to access your account (recommended) or change your settings at https://www.google.com/settings/security/lesssecureapps so that your account is no longer protected by modern security standards. 

To learn more, see https://support.google.com/accounts/answer/6010255. 

Sincerely,
The Google Accounts team

【问题讨论】:

  • 您是否检查过简单邮件是否在您使用的服务器上发送
  • 您是否尝试将 SMTPSecure 设置为 'tls' 并将 Port 设置为 587?
  • 这个转储对诊断没有多大用处 - 发布您的代码并设置 SMTPDebug = 3 以获取更多调试信息。

标签: php email phpmailer


【解决方案1】:

检查您的 Gmail/帐户和导入/其他 Google 帐户设置

某些应用和设备使用不太安全的登录技术,这使得 您的帐户更容易受到攻击。您可以关闭这些应用的访问权限, 我们推荐,或者如果您想使用它们,请打开访问权限,尽管 风险。了解更多

访问不太安全的应用程序关闭打开

改为“开启”

有同样的问题,但现在对我有用。

【讨论】:

    【解决方案2】:

    我经常遇到这个问题,GMAIL 不允许使用脚本发送电子邮件。登录并检查您在代码中使用的电子邮件,以查看您是否收到有关您帐户的恶意活动的通知。如果是,那么我通过从我的 HOST 登录 GMAIL 并允许它使用电子邮件发送邮件来解决此问题。

    不确定这是否适用于您的问题

    【讨论】:

    • 是的,这是正确的,我收到一封来自 gmail 的电子邮件,说我的登录尝试被阻止。为什么会这样,我该如何恢复?请检查更新的问题。
    • 我认为邮件中有您需要的所有详细信息,请按照说明进行操作
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2017-11-04
    • 1970-01-01
    • 2015-10-23
    • 1970-01-01
    • 2017-02-09
    相关资源
    最近更新 更多