我无法在主持人(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());
}
}
我收到此错误:
错误遇到错误
无法使用PHP mail()发送电子邮件。您的服务器可能不是 配置为使用此方法发送邮件。
User-Agent:CodeIgniter
答案 0 :(得分:0)
将下面的配置设置为可行。
$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";
由于