2015-12-15 65 views
2

我不知道哪个部分与我的代码错误,我将以codeigniter中的HTML格式发送邮件,但我的邮件总是被76个字符包裹,虽然我已经设置了自动换行假。Codeigniter邮件内容总是包裹

这里是我的代码:

$content = "<html>"; 
    $content .= "Dear GA,<br/><br/>"; 
    $content .= "You have request for Car use, below is the detail data :<br/>"; 
    $content .= "<b>Request No :</b> ".$reqno."<br/>"; 
    $content .= "<b>Date :</b> ".$date."<br/>"; 
    $content .= "<b>Time :</b> ".$time."<br/>"; 
    $content .= "<b>Destination :</b> ".$dest."<br />"; 
    $content .= "<b>Passenger :</b> (".$jml.") ".$pasr."<br />"; 
    $content .= "<br /><br /><br /><i style='color:grey'>Send By WIS System Automatic Mail</i></html>"; 

    $ci = get_instance(); 
    $ci->load->library('email'); 
    $ci->email->set_mailtype("html"); 
    $ci->email->set_wordwrap(FALSE); 
    $ci->email->from('[email protected]', 'WIS System'); 

    $ci->email->to('[email protected]'); 
    $ci->email->subject('Car Request'); 
    $ci->email->message($content); 

    if ($this->email->send()) { 

     echo 'Email sent.'; 
    } 
    else{ 

     show_error($this->email->print_debugger()); 
    } 

但HTML源代码结果总是这样(包裹着等号)

<html>Dear GA,<br/><br/>You have request for Car use, below is the detail d= 
ata :<br/><b>Request No :</b> C15L020<br/><b>Date :</b> 2015-12-11<br/><b>T= 

ime :</b> 10:00<br/><b>Destination :</b> Jakarta<br /><b>Passenger :</b> (2= 
) Passenger name<br /><br /><br /><br /><i style=3D'color:grey'>Send By WIS = 
System Automatic Mail</i></html> 

任何人都可以给我一个建议,我应该怎么办?

感谢

回答

0

之前,请包括这个代码我不知道,但尝试

$ci->email->subject('Car Request'); 
$ci->$email->IsHTML(true); 
+0

喜Digpal,感谢您的答复。但是,在应用你的代码后,我得到这个错误:'调用未定义的方法CI_Email :: IsHTML()' –

0

试试这个:

$this->load->library('email'); 
$config['charset']  = 'utf-8'; 
$config['mailtype']  = 'html'; 
$config['wordwrap'] = FALSE; 



//your SMTP settings 
$config['protocol']  = 'smtp'; 
$config['smtp_host'] = 'exchange.example.com'; //ssl:// 
$config['smtp_user'] = '[email protected]'; 
$config['smtp_pass'] = 'password'; 
$config['smtp_port'] = 25; 

$this->email->set_newline("\r\n"); 
$this->email->set_crlf("\r\n"); 

$this->email->initialize($config); 

$this->email->clear(); 

// 
$content = "<html>"; 
$content .= "Dear GA,<br/><br/>"; 
$content .= "You have request for Car use, below is the detail data :<br/>"; 
$content .= "<b>Request No :</b> ".$reqno."<br/>"; 
$content .= "<b>Date :</b> ".$date."<br/>"; 
$content .= "<b>Time :</b> ".$time."<br/>"; 
$content .= "<b>Destination :</b> ".$dest."<br />"; 
$content .= "<b>Passenger :</b> (".$jml.") ".$pasr."<br />"; 
$content .= "<br /><br /><br /><i style='color:grey'>Send By WIS System Automatic Mail</i></html>"; 


$this->email->from($frome, $fromn); 
$this->email->to($email); 

$this->email->subject($subject); 


$this->email->message($content); 


$this->email->send(); 
+0

感谢您的响应Dray,但我尝试你的代码后没有什么区别。 –

+0

它仍然包裹? – Dray

+0

在我的情况,是的,它仍然 –