发送电子邮件codeigniter 3不工作localhost使用wamppserver

时间:2016-12-31 09:09:20

标签: email codeigniter-3

 $config = Array(
    'protocol' => 'smtp',
    'smtp_host' => 'smtp.googlemail.com',
    'smtp_port' => 587,
    'smtp_user' => 'example@gmail.com',
    'smtp_pass' => 'password',
    'mailtype'  => 'html', 
    'charset'   => 'iso-8859-1'
);

$this->email->from('example@gmail.com', 'easyfact');
$this->email->to('example@gmail.com');
$this->email->cc('example@gmail.com');
$this->email->bcc('example@gmail.com');
$this->email->subject('Email Test');
$this->email->message('Testing the email class.');
$this->email->send();
echo $this->email->print_debugger();

reulst网站

 Failed to connect to mailserver at "localhost" port 25, verify your "SMTP" and "smtp_port" setting in php.ini or use ini_set()

Unable to send email using PHP mail(). Your server might not be configured to send mail using this method.

我使用wamppserver helf me

1 个答案:

答案 0 :(得分:0)

您没有在任何地方使用$config变量。呼叫

$this->email->initialize($config);

这应该可以解决你的问题。

另请参阅:Setting Email Preferences部分Codeigniter电子邮件类文档。