【发布时间】:2015-09-06 04:24:33
【问题描述】:
今天我使用代码点火器发送电子邮件但无法正常工作。所以请任何人帮助我。
这是我的控制器页面代码;
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
class Welcome extends CI_Controller {enter code here
function __construct() {
parent::__construct();
$this->load->helper(array('form', 'url'));
// $this->load->library('pagination');
$this->load->library('session','form_validation');
}
function sendMail()
{
$config = Array(
'protocol' => 'smtp',
'smtp_host' => 'ssl://smtp.gmail.com',
'smtp_port' => 465,
'smtp_user' => 'siva@gmail.com', // here goes your mail
'smtp_pass' => 'mygamilpassword', // here goes your mail password
'mailtype' => 'html',
'charset' => 'iso-8859-1',
'wordwrap' => TRUE
);
$this->email->initialize($config);
$message = 'hiiiiii';
$this->load->library('email', $config);
$this->email->set_newline("rn");
$this->email->from('siva@gmail.com'); // here goes your mail
$this->email->to('sam@gmail.com');// here goes your mail
$this->email->subject('Resume from JobsBuddy');
$this->email->message($message);
if($this->email->send())
{
echo 'Email sent.';
}
else
{
show_error($this->email->print_debugger());
}
} $this->sendMail;
}
并在我的本地主机中打开 php.extension->php.openssl enable 以及 465 的端口号更改和 smtp:smtp.gmail.com 这都是启用它。
但不工作帮助我。?
【问题讨论】:
-
这个问题可能对stackoverflow.com/questions/29735568/…有帮助
-
查看link
标签: codeigniter