I am trying to send two emails, each from a different sender. The problem is that the second email is sent from the sender of the first email.
Codeigniter is ignoring the $this->email->from
of the second email
$this->load->library('email');
$html="some text";
// send email
$config['mailtype'] = 'html';
$config['protocol'] = "smtp";
$config['smtp_host'] = 'ssl://smtp.googlemail.com';
$config['smtp_user'] = 'user@gmail.com';
$config['smtp_pass'] = 'password';
$config['smtp_port'] = '465';
$config['newline'] = "\r\n";
$this->email->initialize($config);
$this->email->from('myemail@gmail.com', '');
$this->email->to("someemail@site.com");
$this->email->subject("The subject");
$this->email->message($html);
if($this->email->send()) {
}
$this->email->clear();
$config1['mailtype'] = 'html';
$this->email->initialize($config1);
$this->email->from('thesecondemail@www.com', 'The test');
$this->email->to("user@eee.com");
$html="Some other text";
$this->email->subject("hello some text");
$this->email->message($html);
if($this->email->send()) {
}