I'm working with Codeigniter in CPanel and my code already sends a mail, but when it gets to the receiver, the hostname is shown on the sender. I tried some answer to questions as : Change the sender name php mail instead of sitename@hostname.com but in Codeigniter, they don't work.
This is my code:
$config = Array(
'protocol' => 'ssmtp',
'smtp_host' => 'ssl://ssmtp.googlemail.com',
'smtp_port' => 465,
'smtp_user' => 'mail@domainiwant.com',
'smtp_pass' => 'password',
'mailtype' => 'html',
'charset' => 'iso-8859-1',
'useragent' => 'MY NAME',
);
$this->load->library('email', $config);
$this->email->set_newline("\r\n");
$this->email->from('mail@domainiwant.com', 'MY NAME');
$email_to = 'receiver@gmail.com';
$this->email->to($email_to);
$this->email->message('Message testing ...');
$this->email->send();
However, as I said, when the mail gets to the receiver, they appear with the hostname and a completely different mail address like the one I put on $config
I know this only sets the envelope sender
but I want to set the mail address to be mail@domainiwant.com
instead of receiving the mail with somemail@host.com.ex