2017-10-18 4 views
1

Je travaille sur un projet qui a besoin d'envoyer email.I l'utiliser comme mon contrôleurerreur d'envoi dans CodeIgniter

$from_email = $this->input->post('email'); 
$to_email = "[email protected]"; 
$name = $this->input->post('name'); 
$phno = $this->input->post('phno'); 
$from = $this->input->post('start'); 
$to = $this->input->post('end'); 
$message = $this->input->post('message'); 
    $bodyContent="<table> 
    <tr><td>Name:</td><td>$name</td></tr> 
    <tr><td>Phno:</td><td>$phno</td></tr> 
    <tr><td>From Date:</td><td>$from</td><td>To Date:</td><td>$to</td></tr> 
    <tr><td>Message:</td><td>$message</td></tr> 
    </table>"; 
//Load email library 
    $this->load->library('email'); 
    $this->email->from($from_email, $name); 
    $this->email->to($to_email); 
    $this->email->subject('Enquiry From Test TOURS'); 
    $this->email->message($bodyContent); 
//Send mail 
if($this->email->send()) { 
    $this->session->set_flashdata("email_sent","Email sent successfully."); 
} else { 
    $this->session->set_flashdata("email_sent","Error in sending Email."); 
} 
redirect('test_view/index'); 

Et je reçois la sortie par la poste comme celui-ci comme

<table> 
    <tr><td>Name:</td><td>wer</td></tr> 
    <tr><td>Phno:</td><td>wer</td></tr> 
    <tr><td>From Date:</td><td>10/18/2017</td><td>To 
    Date:</td><td>10/25/2017</td></tr> 
    <tr><td>Message:</td><td>wer</td></tr> 
</table> 

Je ne sais pas pourquoi je reçois la sortie dans le courrier comme ceci, quelqu'un peut-il résoudre cette erreur s'il vous plaît.

Répondre

0

utilisation de la configuration mailtype 'html' dans le fichier de configuration Email

$config['mailtype'] = 'html'; 

de user guide

0

Vous devez définir le type comme html:

$ this-> Email-> set_mailtype ("html");

+0

sorrry, je na pas obtenir. –