2015-12-15 66 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

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