2017-01-10 67 views
-1

即時通訊工作與codeigniter,即時通訊新的,所以有一些問題,我不知道發生了什麼事情,其中​​一個問題是關於部落的webmail,當我打開從應用程序時,它會顯示格式化文本的html標記,因此我添加了一些我在stackoverflow問題中找到的代碼行,但不會顯示所有電子郵件上濺起的文本。html格式部落配置錯誤

例子:

This is a multi-part message in MIME format. Your email application may not support this format. --B_ALT_5874cd6abc9bb Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 250 dasasdasd 1 0 [email protected] AirOne Continental 00135 17-01-27 OPO Porto, Portugal LIS Lisbon, Portugal Cn Wn LIS Lisbon, Portugal 250+0+0 17-01-10 12:02 Valor total: 250 Nome: dasasdasd Nr. adultos: 1 Nr. crianças: 

我重新檢查發送的笨電子郵件的配置,但不能發現什麼問題。

我的代碼:

$config = Array(

    'protocol' => 'smtp', 

    'smtp_host' => 'mail.domain.com', 

    'smtp_port' => 25, 

    'smtp_user' => '[email protected]', 

    'smtp_pass' => 'mypassword', 

    'mailtype' => 'html', 

    'charset' => 'utf-8', 

    'wordwrap' => TRUE 

); 

$this->load->library('email'); 
$this->email->initialize($config); 
$this->email->set_newline("\r\n"); 
     $this->email->set_mailtype('html'); 
     $this->email->set_header('MIME-Version', '1.0; charset=utf-8'); 
$this->email->set_header('Content-type', 'text/html'); 
$this->email->from('[email protected]', 'Name'); 
$this->email->to('[email protected]'); 
$this->email->reply_to($_SESSION['email']); 
$message = $this->load->view('email/finalizar_nos',$data,TRUE); // this will return you html data as message 
$this->email->subject('NEW EMAIL: '. $_SESSION['name']); 
$this->email->message($message); 
$result = $this->email->send(); 

$data['data_inserido'] = date('Y-m-d H:i:s'); 
$this->db->insert('emails',$data); 

echo $this->db->insert_id(); 

回答

0
/*In Ccnfig*/ 

$config = Array(

    'protocol' => 'smtp', 
    'smtp_host' => 'mail.domain.com', 
    'smtp_port' => 25, 
    'smtp_user' => '[email protected]', 
    'smtp_pass' => 'mypassword', 
    'mailtype' => 'html', 
    'charset' => 'utf-8', 
    'newline' => '\r\n', 
    'wordwrap' => TRUE 
); 

/*Mail part*/ 

$this->load->library('email'); 
$this->email->initialize($config); 

$this->email->from('[email protected]', 'Name'); 
$this->email->to('[email protected]'); 
$this->email->reply_to($_SESSION['email']); 

$message = $this->load->view('email/finalizar_nos',$data,TRUE); 
$this->email->subject('NEW EMAIL: '. $_SESSION['name']); 
$this->email->message($message); 

if (!$this->email->send()) 
{ 
    echo "Error in Email sending"; 
} 
else 
{ 
    echo "Success"; 
    $data['data_inserido'] = date('Y-m-d H:i:s'); 
    $this->db->insert('emails',$data); 

    echo $this->db->insert_id(); 
} 
+0

如果這個幫助,請** [其標記爲接受**](http://meta.stackexchange.com/questions/5234/how-does-accepting -an回答工作)。因此[** VOTE UP **會導致我的TAG計數](http://meta.stackexchange.com/questions/173399/how-to-upvote-on-stack-overflow) –