send html mail using codeigniter

codeigniter send email html view
how to send email in codeigniter using smtp
how to send email in codeigniter using gmail smtp
codeigniter send email->to multiple recipients
codeigniter email library download
how to send email in codeigniter from localhost demo
how to create dynamic email template in codeigniter
cannot send mail with no "from" header.

Error in mail content using SMTP in codeigniter Actually, my mail is sent with HTML tags and it is showing the HTML tags which is not correct.

$config = Array(
'protocol' => 'smtp',
        'smtp_host' => 'ssl://',
        'smtp_port' => 465,
        'smtp_user' => '',
        'smtp_pass' => '',
        'mailtype'  => 'html', 
        'charset' => 'utf-8',
        'wordwrap' => TRUE

    $this->load->library('email', $config);
    $email_body ="<div>hello world</div>";
    $this->email->from('', 'ddd');

    $list = array('');
    $this->email->subject('Testing Email');

    echo $this->email->print_debugger();

If am sending mail without using SMTP it works fine. What is my mistake?

You can try this line of code which will set the mail type to be for HTML:


Email Class, If you prefer not to set preferences using the above method, you can instead put them into If you send HTML email you must send it as a complete web page. When a user signs up, we might want to send them an email to verify their email address and allow the user to confirm subscription. We also use email to reset forgotten passwords, send invoice and receipts to customers, etc. CodeIgniter makes it super easy for us to send emails from our application using a variety of options.

As of CodeIgniter 3.x. There are many features added. This example is almost same with earlier versions, but you can do much more.

Follow the link for documentation.

// load email library

// prepare email
    ->from('', 'Example Inc.')
    ->subject('Hello from Example Inc.')
    ->message('Hello, We are <strong>Example Inc.</strong>')

// send email

If you have template design. You can also include template in message method like this ...

->message($this->load->view('email_template', $data, true))

Here, the first parameter is email_template.php in your views directory, second parameter the data to be sent to email template, you can set it '' or array() or [] if not passing any dynamic data and last parameter true make sure, you grab the template data instead output.

Hope this is helpful.

send html mail using codeigniter, $config = Array( 'protocol' => 'smtp', 'smtp_host' => 'ssl://', 'smtp_port' => 465, 'smtp_user' => '', 'smtp_pass' => '', 'mailtype' => 'html', 'charset' => 'utf-8', 'wordwrap' => TRUE ); $this->load->library('email', $config); $this->email->set_newline("\r\n"); $email_body ="<div>hello Email Class¶ CodeIgniter’s robust Email Class supports the following features: Multiple Protocols: Mail, Sendmail, and SMTP; TLS and SSL Encryption for SMTP; Multiple recipients; CC and BCCs; HTML or Plaintext email; Attachments; Word wrapping; Priorities; BCC Batch Mode, enabling large email lists to be broken into small BCC batches. Email Debugging tools

Setting the mail type to HTML works for me:

$email_setting  = array('mailtype'=>'html');

Sending HTML mail in codeignitor, Chat with fellow EECMS users in the 'Sending HTML mail in codeignitor' I am new to codeignitor, i try to send HTML content in email, but received mail contains X-Sender: X-Mailer: CodeIgniter X-​Priority: 3 Below is the HTML that is being sent using the CI email function. How to Send Email using CodeIgniter. Sending email in CodeIgniter is much easier and you may set preferences in accordance with your needs. CodeIgniter supplies an Email library to sending email in program. Codeigniter supported inbuilt Mail library which simplifies the email sending process.

Try to manually set the content type header doing this:

$this->email->set_header('Content-Type', 'text/html');

That solve the issue for me.

How to Send Email using CodeIgniter, CodeIgniter Email Configuration​​ php defined('BASEPATH') OR exit('No direct script access allowed'); $config = array( 'protocol' => 'smtp', // 'mail', 'sendmail', or 'smtp' 'smtp_host' => '', 'smtp_port' => 465, 'smtp_user' => ' ', 'smtp_pass' => '12345!' How to send email in codeigniter? Now I will explain how to send email using PHP and CodeIgniter Framework,you must load email library in order to send emails

To send HTML email you first have to compose your message in a variable and then pass that variable to codeigniter's "$this->email->message()" method, like below,


 $message = "
         <title>your title</title>
         <p>Hello Sir,</p>
         <p>Your message</p>

   $this->email->from('email id', 'name');
   $this->email->to('email id');

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

   if ($this->email->send()) {
     print "success";
   } else {
     print "Could not send email, please try again later";

hope it will help.


How to send email using HTML templates in Codeigniter, Step 1: Create HTML file with suits to your template. Path : /application/views/​emails/test-email.php Validate form fields using CodeIgniter Form Validation library. Pass form data in sendEmail() function to send contact request email. Store the status message in an Array. Pass the POST data and form submission status to the view. sendEmail() – Send HTML email with the contact form data using Email library in CodeIgniter.

Send email using HTML email template in Codeigniter, In this article you'll learn how to use email template with dynamic variables for send email to user after signup using Codeigniter email library. Step 1: Create email  Sending email in CodeIgniter is much easier. You also configure the preferences regarding email in CodeIgniter. CodeIgniter provides following features for sending emails −. Multiple Protocols − Mail, Sendmail, and SMTP. TLS and SSL Encryption for SMTP. Multiple recipients. CC and BCCs. HTML or Plaintext email.

codeigniter, But you don't just want a plain text email. You want a pretty html email. Set your config file as html: $config['mailtype'] = 'html';. If you want to pass data (like a  Also, you can send email via SMTP server using CodeIgniter Email library. In this tutorial, we will show how you can send HTML email via SMTP server in CodeIgniter application. The CodeIgniter email library will be used to send email using SMTP server. Send email via SMTP server in CodeIgniter. At first include the CodeIgniter email library.

Sending Email in CodeIgniter, Sending Email using CodeIgniter Email library. Example code to send a text email, HTML email, and email with an attachment in CodeIgniter. CodeIgniter is no different as it has a great email sending class that ensures that CodeIgniter projects could send emails without difficulty. In this article, I will describe how to send emails in a CodeIgniter application using SMTP.

  • I don't think ssl:// is part of a host name. Maybe there's another setting to turn on SSL?
  • codeigniter full html email configuration: