Date Added: 14/01/2015

Codeigniter Sending Email With smtp


function index()
 {
 $config = Array(
 'protocol' => 'smtp',
 'smtp_host' => 'ssl://smtp.googlemail.com',
 'smtp_port' => 465,
 'smtp_user' => 'my mail',
 'smtp_pass' => 'my password',
 'mailtype' => 'html',
 'charset' => 'iso-8859-1'
 );
 $this->load->library('email', $config);
 $this->email->set_newline("\r\n");
<!--more-->
$this->email->from('aaa@gmail.com', 'aaa');
 $this->email->to('bbb@gmail.com');
 $this->email->subject('This is an email test');
 $this->email->message('It is working. Great!');
 $result = $this->email->send();
 echo $this->email->print_debugger();

}

Sending Email in a loop

$list =array(

"my name 1"=>"example1@example.dd",
"my name2"=>"example2@example.dd",
"my name 3"=>"example3@example.dd"
);

foreach ($list as $name => $address)
{
$this->email->clear();

$this->email->to($address);
$this->email->from('your@example.com');
$this->email->subject('Here is your info '.$name);
$this->email->message('Hi '.$name.' Here is the info you requested.');
$this->email->send();
}

Last Update: Posted by: müslüm ÇEN
Not Commented Yet !
Please login in order to comment . Login