这是我的代码,我已经尝试了12个小时,但没有找到解决方案。我的电子邮件转到垃圾邮件文件夹,它应该转到收件箱。你能改正吗?
问题可能在于smtp细节,这段代码在开发服务器上运行正常,但是当我们转移到客户端服务器并更新smtp时,它显示邮件进入垃圾邮件文件夹的问题。
public function step4()
{
parse_str(substr(strrchr($_SERVER['REQUEST_URI'], "?"), 1), $_GET);
$data['trip'] = $this->input->xss_clean($_GET['trip']);
$data['travel_date'] = $this->input->xss_clean($_GET['travel_date']);
$data['origin_id'] = $this->input->xss_clean($_GET['origin_id']);
$data['destination_id'] = $this->input->xss_clean($_GET['destination_id']);
$data['origin'] = $this->input->xss_clean($_GET['origin']);
$data['destination'] = $this->input->xss_clean($_GET['destination']);
$fees = count(explode(',',substr($this->input->xss_clean($_GET['checkbox']),0,-1)));
$data['price'] = $this->input->xss_clean($_GET['price']);
$data['bus_id'] = $this->input->xss_clean($_GET['bus_id']);
$data['timing'] = $this->input->xss_clean($_GET['timing']);
$data['duration'] = $this->input->xss_clean($_GET['duration']);
$data['kilometers'] = $this->input->xss_clean($_GET['kilometers']);
$data['stops'] = $this->input->xss_clean($_GET['stops']);
$data['route_id'] = $this->input->xss_clean($_GET['route_id']);
$data['time_id'] = $this->input->xss_clean($_GET['time_id']);
$data['checkbox'] = $this->input->xss_clean($_GET['checkbox']);
// print_r(explode(',',substr($data['checkbox'],0,-1)));
$data['name'] = $this->input->xss_clean($_GET['name']);
$data['contact'] = $this->input->xss_clean($_GET['contact']);
$data['email'] = $this->input->xss_clean($_GET['email']);
$data['pickup_place'] = $this->input->xss_clean($_GET['pickup_place']);
$data['session_id'] = $this->session->userdata('session_id');
$data['ref_code'] = $this->input->xss_clean($_GET['ref_code']);
if($this->input->xss_clean($_GET['trip'])=="Round Trip"){
$data['return_date'] = $this->input->xss_clean($_GET['return_date']);
$data['return_origin_id'] = $this->input->xss_clean($_GET['destination']);
$data['return_destination_id'] = $this->input->xss_clean($_GET['origin']);
$fee_return = count(explode(',',substr($this->input->xss_clean($_GET['checkbox_return']),0,-1)));
$data['return_price'] = $this->input->xss_clean($_GET['return_price']);
$data['return_bus_id'] = $this->input->xss_clean($_GET['return_bus_id']);
$data['return_timing'] = $this->input->xss_clean($_GET['return_timing']);
$data['return_duration'] = $this->input->xss_clean($_GET['return_duration']);
$data['return_kilometers'] = $this->input->xss_clean($_GET['return_kilometers']);
$data['return_stops'] = $this->input->xss_clean($_GET['return_stops']);
$data['return_route_id'] = $this->input->xss_clean($_GET['return_route_id']);
$data['return_time_id'] = $this->input->xss_clean($_GET['return_time_id']);
$data['checkbox_return'] = $this->input->xss_clean($_GET['checkbox_return']);
$data['total_price'] = $this->input->xss_clean($_GET['total_price']);
}
if($this->input->xss_clean($_GET['trip'])=="Round Trip"){
$data['fee'] = count(explode(',',substr($data['checkbox'],0,-1))+explode(',',substr($data['checkbox_return'],0,-1)))*1;
} else {
$data['fee'] = count(explode(',',substr($data['checkbox'],0,-1)))*1;
}
$name=$this->input->xss_clean($_GET['name']);
$email=$this->input->xss_clean($_GET['email']);
$pickup_place=$this->input->xss_clean($_GET['pickup_place']);
$contact=$this->input->xss_clean($_GET['contact']);
$pickup_id=$data['pickup_place'][1];
$data['step_four'] = $this->select_seat_model->insert_select_seat($name, $email, $pickup_place, $contact, $data);
$data['reservation'] = $this->select_seat_model->getReservation($route_id);
$data['pickup'] = $this->select_seat_model->getPickupName($pickup_id);
//$this->session->set_userdata($array);
$config['protocol'] = 'smtp';
$config['smtp_host'] = 'localhost';
$config['smtp_port'] = 25;
$config['smtp_user'] = 'new_psdxpress@psdxpress.com';
$config['smtp_pass'] = 'X52udnHGgD6P';
$config['mailtype'] = 'html';
$config['charset'] = 'iso-8859-1';
$config['wordwrap'] = TRUE;
// Load email library and passing configured values to email library
$this->load->library('email', $config);
$this->email->set_newline("\r\n");
// Sender email address
$this->email->from('noreply@psdxpress.com', 'no reply');
// Receiver email address
$this->email->to('akramalibikaner@gmail.com',$this->input->post('email'));
// Subject of email
$this->email->subject('E-ticket');
// Message in email
$body = $this->load->view('e-ticket.php',$data,TRUE);
$this->email->message($body);
$ok = $this->email->send();
if($ok=1) {
$this->session->set_flashdata('msg','E-ticket sent on your mail');
$this->load->view('step4.php');
} else {
$this->session->set_flashdata("msg","Error in sending Email.");
$this->load->view('dashboard');
}
}