-
Notifications
You must be signed in to change notification settings - Fork 4
Richmail
By Jan Willem Penterman [email protected] (Genoil on codeigniter.com) September 29, 2006
This library extends the Email library, adding the following functions:
- parse message body for images and add them as inline attachments
- caches base64 encoded attachements for better performance
The directories inside this archive should look familiar enough to you to know where to put the files...
[code]
// Load Richmail library instead of 'email': $this->load->library('richmail');
// Since it subclasses CI_Email, this is all the same:
$this->richmail->from('[email protected]', 'Sender');
$this->richmail->to('[email protected]', 'Recipient');
$this->richmail->subject('Richmail test');
// Load message like any CI view: $message = $this->load->view("richmail_view", array(), true);
// Convert message to have images reference inline content-id's.
// $message is passed by reference, but is also returned if you
// don't understand what I'm talking about.
$this->richmail->inline($message);
// This is like Email again: $this->richmail->message($message); $this->richmail->send(); [/code]
-
Currently, only HTML image references are supported, no CSS. This is
because inline CSS background images aren't supported very well in HTML email anyway. -
The library assumes the host that serves the images is equal to the CI's base_url config var.
-
Base64 caching speeds up attachment building about 2 times, but I'm not too happy about having to duplicate the whole Email::_build_message() method.