Today I made a contact form on my website. All is working fine, the emails are sending correctly to the specified email ($this->email->to('myemail@address.com')
).
In my application/config/email.com I have:
$config = Array(
'protocol' => 'smtp',
'smtp_host' => 'ssl://smtp.googlemail.com',
'smtp_port' => 465,
'smtp_user' => 'myemail@gmail.com',
'smtp_pass' => 'mypassword',
'mailtype' => 'html',
'charset' => 'iso-8859-1'
);
But now every mail I send from my website are recieved as 'myemail@gmail.com' when I look into the mailbox of myemail@address.com.
I don't know if this is the standard behaviour?
How can I use the email typed in into the input box as the 'from' email?
My controller function looks like this:
public function sendmail()
{
$config['mailtype'] = 'html';
$config['protocol'] = 'smtp';
$config['smtp_host'] = 'ssl://smtp.googlemail.com';
$config['smtp_port'] = 465;
$config['smtp_user'] = 'user@gmail.com';
$config['smtp_pass'] = 'user@owrb';
$confog['wordwrap'] = TRUE;
$this->load->library('email', $config);
$this->email->set_newline("\r\n");
$this->email->from($this->input->post('from'), $this->input->post('name'));
$this->email->to('info@keessonnema.nl');
$this->email->subject($this->input->post('subject'));
$naam = $this->input->post('name');
$email = $this->input->post('from');
$tel = $this->input->post('tel');
$site = $this->input->post('site');
$sub = $this->input->post('subject');
$msg = $this->input->post('message');
$this->email->message("
<div id='email'>
<p><b>Bedrijf:</b> <br/> $naam</p>
<p><b>Email:</b> <br/> $email</p>
<p><b>Tel:</b> <br/> $tel</p>
<p><b>Website:</b> <br/> $site</p>
<p><b>Onderwerp:</b> <br/> $sub</p>
<p><b>Toelichting:</b> <br/> $msg</p>
</div>
");
$success = ('
<div style="position: absolute; top: 50%; left: 50%; background-color: rgba(0,0,0,0.8);">Uw Email is succesvol verzonden!</div>
');
if($this->email->send())
{
$this->session->set_flashdata('msg', 'Email successvol verzonden.');
redirect('contact/index');
}
else
{
show_error($this->email->print_debugger());
}
}
Hope someone can help.