今天我在我的网站上做了一个联系表格。一切正常,电子邮件正确发送到指定的电子邮件 ( $this->email->to('myemail@address.com')
)。
在我的 application/config/email.com 我有:
$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'
);
但是现在,当我查看 myemail@address.com 的邮箱时,我从我的网站发送的每封邮件都会收到“myemail@gmail.com”。
我不知道这是否是标准行为?
如何使用在输入框中输入的电子邮件作为“发件人”电子邮件?
我的控制器功能如下所示:
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());
}
}
希望有人可以提供帮助。