无法使用codeigniter发送电子邮件

时间:2012-11-12 14:05:17

标签: codeigniter email sendmail codeigniter-2

我无法通过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.

我无法弄清楚问题。如果你知道原因请帮助。

4 个答案:

答案 0 :(得分: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());
        }

    }

答案 1 :(得分:2)

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

答案 2 :(得分:0)

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

答案 3 :(得分:0)

我有同样的问题,因为有几个过时的GoDaddy教程提供了确认不正确的主机地址。我发现你在遇到这个问题的时候也在使用GoDaddy的电子邮件服务(secureserver.net)。对于遇到此问题的任何其他人,更新的信息......

host = 'smtpout.secureserver.net'

..(目前)详细说明:link