Codeigniter Email Class Library
Codeigniter Email Class Library – Email class library provide various functions that are used to send email. It can be done by protocal. $this->load->library(’email’); is used to load the library. Here in this tutorial, we are going to explain how to use email class library.
Codeigniter email class library | Load | Example
Let us understand how file email class works in codeigniter with examples.
Load codeigniter email class library
How to load email class library:
There are following functions available in email class library. Now let us go through one by one to understand.
- 1. Sending email
- 2. Setting email preferences
1. Sending email
Here is simple example of sending email.
Sending email in codeigniter example:-
2. Setting email preferences
Here is simple example of setting email preferences.
Setting email preferences in codeigniter example:-
There are 21 different preferences availables.
There are many types of class reference in email class library.
from($from[$name = ''[$return_path = NULL]])
This function is used to set email address and name of sender.
2. Reply to
reply_to($replyto[$name = ''])
This function is used to set reply to address.
We use this function to set email address of reciever. address can be single or multiple both.
We use this function to set multiple email address of reciever.
This function is used to set email subject.
This function is used to set email message body.
7. Set alt message
This function is used to set alternative email message body.
8. Set header
This function is used to add additional header.
clear([$clear_attachments = FALSE])
This function is used to clear all attachment files.
send([$auto_clear = TRUE])
This method is used to sending the email.
attach($filename[$disposition = ''[$newname = NULL[$mime = '']]])
We use this function to add multiple attachment files.
12. Print debugger
print_debugger([$include = array('headers', 'subject', 'body')])
By using this function we can print any type of error in email class.