Sending HTML e-mails with CodeIgniter Email
There might be times when you wish to display formatted e-mails rather than just plain text, so you may wish to include images, text formatting, and URLs in the body of your e-mail. HTML e-mails will allow you to do this and CodeIgniter Email library can easily be set to do just that.
How to do it...
HTML e-mails can be sent by executing the following steps:
- Create a file
email.php
at/path/to/codeigniter/application/controllers/
. - Add the following code to the controller file
email.php
:<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed'); class Email extends CI_Controller { function __construct() { parent::__construct(); $this->load->helper('url'); $this->load->library('email'); } public ...
Get CodeIgniter 2 Cookbook now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.