【发布时间】:2015-10-25 17:31:00
【问题描述】:
我正在尝试将数组中的姓名、电子邮件、公司、电话和国家/地区插入电子邮件消息中,但我得到的只是一封空电子邮件。 主题,往返于所有作品,但我没有收到电子邮件中的消息。 谁能告诉我我做错了什么?
<? php
public function contact_mail() {
$data = array(
'name' => $this->input->post('name'),
'email' => $this->input->post('email'),
'company' => $this->input->post('company'),
'phone' => $this->input->post('phone'),
'country' => $this->input->post('country')
);
$success = $this->data->save_contact_info($data);
if ($success) {
$data = array('success_message' => 'Thank you. We\'ll be in touch.');
$this->load->view('ajax/json', array('json' => $data));
$this->load->library('email');
$config['mailtype'] = 'html';
$this->email->initialize($config);
$this->email->from("noreply@example.com", "Example Notification Service");
$this->email->to(array('mha@example.com'));
$this->email->subject('Contact form');
$this->email->message($data);
$this->email->send();
}
else {
$this->load->view('ajax/error', array('error_msg' => 'Please fill out all fields.'));
}
}
?>
【问题讨论】:
-
原来它工作正常,但电子邮件中的消息只是“1”。我如何从表格中获取电子邮件信息是姓名、电子邮件、公司、电话和国家/地区?
标签: php ajax codeigniter email