我无法从我的codeigniter发送电子邮件。当我按下发送按钮时它总是重新加载。我不知道这段代码有什么问题。请帮助我,所以我可以将附加的电子邮件发送到目的地我该如何解决这个问题。代码如下:
function send_quotation($no, $email_to, $id_ticket, $problem, $action, $nama)
{
$this->load->model('service_tracking/trans_service_model');
$this->load->library('email');
$config['protocol'] = 'smtp';
$config['smtp_host'] = 'smtp.gmail.com';
$config['smtp_port'] = 465;
$config['smtp_user'] = 'examplefrom@gmail.com';
$config['smtp_pass'] = 'password123';
$config['priority'] = 1;
$config['mailtype'] = 'html';
$config['charset'] = 'iso-8859-1';
$config['starttls'] = TRUE;
$data = $this->trans_service_model->get_emaildata($id_ticket);
$this->email->initialize($config);
$this->load->library('email', $config);
$this->email->set_newline('\r\n');
$this->email->from('examplefrom@gmail.com', 'Example corporation');
$this->email->to('exampleto@gmail.com');
$data = $this->trans_service_model->get_emaildata($id_ticket);
$this->email->initialize($config);
$this->load->library('email', $config);
$this->email->set_newline('\r\n');
$this->email->from('examplefrom@gmail.com', 'Example Corporation');
$this->email->to('exampleto@gmail.com');
$this->email->subject('['.$no.'] - '.$nama.' - Quotation Repair');
$message = "
This is the email contain quotation";
$this->email->message($message);
$this->email->attach('./quotation/'.$no.'.pdf');
$this->email->send();
echo $this->email->print_debugger();
}
答案 0 :(得分:1)
喜欢这个
if (!$this->email->send()) {
echo $this->email->print_debugger();
} else {
echo "Success";
//redirect();
}