• 1 Vote(s) - 5 Average
  • 1
  • 2
  • 3
  • 4
  • 5
send email with html tags

#3
(12-23-2014, 05:13 PM)Avenirer Wrote:
(12-23-2014, 03:27 PM)valencia Wrote: hi all,

I'm sending email with CI but I can't get html tags as I want.
here is my code
this is my Model folder





PHP Code:
   ##forgot password send email
 
   public function forgot_pass($email) {
 
   
     $this
->form_validation->set_rules('email_f_f_pass','email','required|valid_email|is_unique[users.email]|trim');
 
    
     
if($this->form_validation->run() == TRUE && !empty($email ){
 
               
     $config 
= Array(
 
         'protocol' => 'sendmail',
 
         'mailtype' => 'html'
 
         'charset' => 'utf-8',
 
         'wordwrap' => TRUE

      
);


 
    $message $this->load->view('admin/ad_pages/send_email'''true);  
     
     $this
->load->library('email'$config);
 
    $this->email->set_newline("\r\n");
 
    $this->email->from(@$email);
 
    $this->email->to('[email protected]');
 
    $this->email->subject('send email to costomer');
 
    $this->email->message($message);
 
    
     
if($this->email->send()){
 
    
            echo
'<div style="position:relative; top:50px; width:330px; margin:0 auto;" class="alert alert-dismissable alert-danger">
                  <button type="button" class="close" data-dismiss="alert">x</button>
                  <strong>success!</strong>  Please, check your email for new password !!!
                </div>'
;
 
           $this->output->set_header('refresh:3; url='.base_url().'admin/admin_pages/login');
 
    }else{
 
    
     show_error
($this->email->print_debugger());
 
    
    
}
 
   
      
}else{
 
     
          $this
->load->view('admin/ad_pages/forgot_pass');
 
     
      
 
    
        
    



and this my success mesage php page





PHP Code:
<!DOCTYPE HTML>
<
html lang="en-US">
<
head>
    <
meta charset="UTF-8">
    <
title></title>
</
head>
<
body>
    <
h1>success</h1>
 
   <p>your message send <b>successfuly!!</b></p>
</
body>
</
html

in received email I'm getting back the page as it is likethis




Code:
<!DOCTYPE HTML>
<html lang="en-US">
<head>
    <meta charset="UTF-8">
    <title></title>
</head>
<body>
    <h1>success</h1>
   <p>your message send <b>successfuly!!</b></p>
</body>
</html>

instead something like tthis





Code:
[b]success[/b] big like h1 expected
and




Code:
your message send [b]successfuly!![/b]

what did I make wrong,? something with header content type maybe? Can someone help me with this?

I don't think you can define an array like:

$config = Array(
 
         'protocol' => 'sendmail',
 
         'mailtype' => 'html'
 
         'charset' => 'utf-8',
 
         'wordwrap' => TRUE

      
);

You define array by using array() and not Array().


Thank you, that was good to find that Array(), I missed it but after i changed it I'm  still receiving html as it is, there must be something else.
I even changed 'protocol' => 'sendmail', to 'protocol' => 'mail', and tryed but not success.
Reply


Messages In This Thread
send email with html tags - by valencia - 12-23-2014, 03:27 PM
RE: send email with html tags - by Avenirer - 12-23-2014, 05:13 PM
RE: send email with html tags - by valencia - 12-23-2014, 07:04 PM
RE: send email with html tags - by Rufnex - 12-24-2014, 04:09 AM
RE: send email with html tags - by valencia - 12-24-2014, 03:43 PM

Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2021 MyBB Group.