【发布时间】:2020-10-12 00:40:10
【问题描述】:
public function booking() {
$this->load->helper(array('form'));
$this->load->library(array('session','email'));
$this->load->helper('string');
//$nwdb['wen_memid'] = $wen_memid
='W'.random_string('alnum',3).'E'.random_string('alnum',3).'N';
$name = $this->input->post('name');
$phone = $this->input->post('phone');
$email = $this->input->post('email');
$date = $this->input->post('date');
$message = $this->input->post('message');
$config['protocol'] = 'sendmail';
$config['mailpath'] = '/usr/sbin/sendmail';
$config['charset'] = 'iso-8859-1';
$config['wordwrap'] = TRUE;
$config['mailtype'] = 'html';
$this->email->initialize($config);
$this->email->from('mail@gmail.com');
$this->email->to('mail@gmail.com');
$this->email->subject('Appoinment Booking');
$this->email->message('<html>
<head>
</head>
<body>
<H2>Contact Us</H2><br>
<table rules="all" style="border:1px solid #7fb341;"
cellpadding="0">
<tr style="background:#cddfb7;">
<td> <strong>Name: </strong></td><td> '.$name.'</td></tr>
<tr style="background:#cddfb7;">
<td> <strong> Phone: </strong></td><td> '.$phone.'</td></tr>
<td> <strong> Email: </strong></td><td> '.$email.'</td></tr>
<tr style="background:#cddfb7;"><td><strong>Date :</strong></td>
<td>'.$date.'</td></tr>
<tr style="background:#cddfb7;"><td><strong>Message:</strong>
</td><td>'.$message.'</td></tr>
</table><br><br></body>
</html>
');
if ($this->email->send())
{
redirect('/welcome/bookonline');
}
else
{
//error
$this->session->set_flashdata('msg','<div class="alert alert-danger text-
center">There is error in sending mail! Please try again later</div>');
redirect('/');
}
}
以上是我的控制器欢迎代码。欢迎/预订是控制器名称。该表格包含“姓名、电子邮件、日期、联系电话和消息”部分。我想将邮件发送到收件箱部分。我 不要为此使用 smtp。但是在这里,每封邮件都发送到垃圾邮件。请尽快帮助我。
【问题讨论】:
标签: php codeigniter email controller email-spam