今天我在我的网站上制作了一个联系表格。一切都很正常,电子邮件成功发送到指定的电子邮件地址(
在我的application/config/email.com文件中:
$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@gmail.com”,当我查看myemail@address.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());
}
}
希望有人能够提供帮助。