【问题标题】:I can't send email using CodeIgniter and namecaep我无法使用 CodeIgniter 和 namecaep 发送电子邮件
【发布时间】:2017-01-06 20:14:02
【问题描述】:

我无法在主机 (https://www.namecheap.com) 上发送电子邮件。使用CodeIgniter 框架

 $config = Array(
  'protocol' => 'HTTP',// also used smtp
  'smtp_host' => 'mail.sss.com.ng',
  'smtp_port' => 26,
  'smtp_user' => 'ss@sss.com.ng', // change it to yours
  'smtp_pass' => '3333333', // change it to yours
  'mailtype' => 'html',
  'charset' => 'iso-8859-1',
  'wordwrap' => TRUE
  );


    $this->load->library('email', $config);
    $this->email->set_newline("\r\n");
      $this->email->from('sss@sss.com.ng'); // change it to yours
      $this->email->to($to);// change it to yours
      $this->email->subject($subject);
      $this->email->message('6666');
      if($this->email->send())
      {
        echo 'Email sent.';
      }
      else
      {
        show_error($this->email->print_debugger());
      }

    }

我收到此错误:

error 遇到错误

无法使用 PHP mail() 发送电子邮件。您的服务器可能不是 配置为使用此方法发送邮件。

用户代理:CodeIgniter

【问题讨论】:

    标签: php codeigniter


    【解决方案1】:

    把下面的配置放在下面就行了。

    $config['useragent']        = 'CodeIgniter';  
    $config['protocol']         = 'smtp';
    $config['smtp_host']        = '*****';
    $config['smtp_port']        = '**';
    $config['smtp_user']        = '**';
    $config['smtp_pass']        = '****';
    $config['wordwrap']         = TRUE;
    $config['smtp_timeout']     = 5;
    $config['wrapchars']        = 76;
    $config['charset']          = 'utf-8';
    $config['crlf']             = "\r\n";
    $config['validate']         = FALSE;
    $config['mailtype']         = 'html';
    $config['priority']         = '3';
    $config['newline']          = "\r\n"; 
    

    谢谢

    【讨论】:

      猜你喜欢
      • 2013-06-15
      • 2012-10-31
      • 2018-03-28
      • 2012-12-05
      • 1970-01-01
      相关资源
      最近更新 更多