public function sendmail() {
$config = array(
'protocol' => 'smtp',
'smtp_host' => 'ssl://squid.arvixe.com',
'smtp_port' => 465,
'smtp_user' => '******',
'smtp_pass' => '******'
);
$this->load->library('email', $config);
$mailResults = array();
$results = $this->get_emails();
foreach ($results as $result) {
$this->email->from(config_item('email'), config_item('website_name'));
$this->email->to($result['email']);
$this->email->subject('My mail through codeigniter from localhost');
$this->email->message('Hello World…');
if (! $this->email->send()) {
$mailResults[] = $this->email->print_debugger();
}
}
if (! empty($mailResults)) {
show_error(implode('<br />', $mailResults));
}
$this->session->set_flashdata('success', 'Your e-mail has been sent!' . $result['email']);
redirect('admin/mail');
}