phpmailer与codeigniter没有收到电子邮件

时间:2014-08-28 10:44:14

标签: php codeigniter phpmailer

我正在尝试使用带有codeigniter的phpmailer发送电子邮件,成功发送电子邮件,但即使在我的垃圾邮件文件夹中也没有收到任何电子邮件。

我的codeigniter控制器:

$this->load->library('My_PHPMailer');
$mail = new PHPMailer();
$mail->IsSMTP();
$mail->Host = "my host name";
$mail->SMTPAuth = true;    
$mail->Username = "my user name"; 
$mail->Password = "my password"; 
$mail->From = "from email";
$mail->FromName = $this->input->post('firstName') .' '. $this->input->post('lastName');
$mail->AddAddress("shafatahmad00@yahoo.com", "shafat ahmad");
$mail->AddReplyTo($this->input->post('email'), $this->input->post('firstName') .' '. $this->input->post('lastName'));
//$mail->AddCC("imrankasuri@yahoo.com","Ali Imran");
$mail->WordWrap = 50; // set word wrap to 50 characters
$mail->IsHTML(true);  // set email format to HTML
$mail->Subject = "Inquiry from Miltan Corporation";
$mail->Body    = "Mobile Number: " . $this->input->post('phone') . "/r/n".
                 "Product Name: " . $this->input->post('Product_Name') . "/r/n".
                 "Quantity: " . $this->input->post('quantity') . "/r/n".
                 "Message: " . $this->input->post('message');
$mail->AltBody = $this->input->post('message');


if(!$mail->Send())
{
    echo "Mailer Error: " . $mail->ErrorInfo;
}
else
{
    echo "email has been send";
}

0 个答案:

没有答案