【问题标题】:Sending Email prompts Error: 535 Authentication Failed发送邮件提示错误:535 Authentication Failed
【发布时间】:2020-04-22 09:57:37
【问题描述】:

我正在尝试使用 CodeIgniter 发送电子邮件。当我尝试发送电子邮件时,我收到此错误:

Failed to authenticate password. Error: 535 Authentication Failed for no-reply@sample.com
Unable to send email using PHP SMTP. Your server might not be configured to send mail using this method.

我正在使用这段代码:

$config = Array(
        'protocol'    => 'smtp',
        'smtp_host'   => 'smtpout.secureserver.net',
        'smtp_port'   => '465',
        'smtp_user'.  => 'no-reply@sample.com',
        'smtp_pass'   => '0p9o8i7u',
        'smtp_crypto' => 'ssl',
        'mailtype'    => 'html',
        'charset'     => 'iso-8859-1',
        'crlf'        => "\r\n"
);

$this->load->library('email', $config);

$this->email->set_newline("\r\n");
$this->email->from('no-reply@sample.com', 'SYSTEM ROBOT');
$this->email->to('recipient@outlook.com');

$this->email->subject('Sample Subject');
$this->email->message('HTML Content here');

if($this->email->send()){
    return true;
} else {
    return show_error($this->email->print_debugger());
} 

我的项目目前由 GoDaddy 托管,以及我用来发送电子邮件的电子邮件(本例中为 no-reply@sample.com)。

我基于 GoDaddy 网站的 SMTP 设置:https://ph.godaddy.com/help/mail-server-addresses-and-ports-for-business-email-24071

我使用的密码也是正确的,因为我尝试使用 RoundCube 登录电子邮件帐户。

如何解决我遇到的错误?

【问题讨论】:

    标签: php codeigniter email


    【解决方案1】:

    如果您上面的代码是您的真实代码,请尝试使用您的实际帐户更改这部分。

    'smtp_user'.  => 'no-reply@sample.com',
    'smtp_pass'   => '0p9o8i7u',

    因为这个 no-reply@sample.com 可能不是您的真实帐户

    【讨论】:

    • 是的,当然。我只在这篇文章中说明了样本。但是对于我的实际代码,我使用的是正确用户名和密码。
    【解决方案2】:

    我能够解决我的问题。我没有使用 GoDaddy 在他们的 SMTP settings 中的建议:

    'smtp_host'   => 'smtpout.secureserver.net'
    

    首先,转到您的 Web Mail 页面(例如:webmail.yourcpanel.com)并登录您将用于发送电子邮件的电子邮件帐户。

    然后转到其他 Webmail 功能下的配置邮件客户端。您将看到该电子邮件帐户的 SSL/TLS 设置。就我而言,SMTP 主机与 GoDaddy 的建议不同:

    'smtp_host'   => 'mail.sample.com'
    

    之后,电子邮件现在从我的网络应用程序发送。

    【讨论】:

      猜你喜欢
      • 2019-06-02
      • 2015-09-28
      • 1970-01-01
      • 2018-01-01
      • 2021-12-10
      • 1970-01-01
      • 2016-04-11
      • 1970-01-01
      • 2013-01-26
      相关资源
      最近更新 更多