menu

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:

Functions:-

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

EXAMPLE

Here is simple example of sending email.

Sending email in codeigniter example:-

2. Setting email preferences

EXAMPLE

Here is simple example of setting email preferences.

Setting email preferences in codeigniter example:-

There are 21 different preferences availables.

Class reference

There are many types of class reference in email class library.

1. From

This function is used to set email address and name of sender.

2. Reply to

This function is used to set reply to address.

3. To

We use this function to set email address of reciever. address can be single or multiple both.

4. CC

We use this function to set multiple email address of reciever.

5. Subject

This function is used to set email subject.

6. Message

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.

9. Clear

This function is used to clear all attachment files.

10. Send

This method is used to sending the email.

11. Attachment

We use this function to add multiple attachment files.

12. Print debugger

By using this function we can print any type of error in email class.

Advertisements