【问题标题】:Unable to send email using codeigniter无法使用 codeigniter 发送电子邮件
【发布时间】:2012-10-31 23:02:56
【问题描述】:

我无法通过 codeigniter 发送电子邮件。当我尝试使用echo $this->email->print_debugger(); 回显错误时,出现以下错误:

hello: 250-smtpout17-02.prod.mesa1.secureserver.net 
250-PIPELINING
250 8BITMIME

Failed to send AUTH LOGIN command. Error: 502 unimplemented (#5.5.1)

from: 250 ok

to: 553 sorry, relaying denied from your location [---] (#5.7.1)

The following SMTP error was encountered: 553 sorry, relaying denied from your location [--] (#5.7.1)

data: 503 RCPT first (#5.5.1)

The following SMTP error was encountered: 503 RCPT first (#5.5.1)
502 unimplemented (#5.5.1)
The following SMTP error was encountered: 502 unimplemented (#5.5.1)
Unable to send email using PHP SMTP. Your server might not be configured to send mail using this method.

我无法找出问题所在。如果您知道原因,请提供帮助。

【问题讨论】:

  • 你能显示你使用的代码吗.....

标签: codeigniter email sendmail codeigniter-2


【解决方案1】:

由于几个过时的 GoDaddy 教程,我遇到了同样的问题,这些教程随后确认了不正确的主机地址。我看到您在遇到此问题时也在使用 GoDaddy 的电子邮件服务 (secureserver.net)。对于遇到此问题的其他任何人,更新的信息...

host = 'smtpout.secureserver.net'

..(当前)在此处详细说明:link

【讨论】:

    【解决方案2】:

    问题出在 SMTP 主机上。我提供了一个错误的 smtp 主机,这就是它给我这个错误的原因。

    【讨论】:

    • 更新了这个问题和原始问题,因为这种方法为我解决了同样的问题。有关更多详细信息,请参阅我的回答。
    【解决方案3】:

    您好,我在项目中使用了这段代码。我是从 Gmail 发送的,所以请根据您的服务器进行更改。

    function sendMail()
        {
            $config = Array(
          'protocol' => 'smtp',
          'smtp_host' => 'ssl://smtp.googlemail.com',
          'smtp_port' => 465,
          'smtp_user' => 'xxx@gmail.com', // change it to yours
          'smtp_pass' => 'xxx', // change it to yours
          'mailtype' => 'html',
          'charset' => 'iso-8859-1',
          'wordwrap' => TRUE
        );
    
                $message = '';
                $this->load->library('email', $config);
              $this->email->set_newline("\r\n");
              $this->email->from('xxx@gmail.com'); // change it to yours
              $this->email->to('xxx@gmail.com');// change it to yours
              $this->email->subject('Resume from JobsBuddy for your Job posting');
              $this->email->message($message);
              if($this->email->send())
             {
              echo 'Email sent.';
             }
             else
            {
             show_error($this->email->print_debugger());
            }
    
        }
    

    【讨论】:

      【解决方案4】:

      我猜 SMTP 服务器不允许你从你的 IP 发送邮件。确保您使用的是正确的 SMTP 服务器。

      【讨论】:

        猜你喜欢
        • 2013-06-15
        • 2012-12-05
        • 1970-01-01
        • 2015-09-06
        • 2012-05-30
        相关资源
        最近更新 更多