How To send email with Codeigniter using SendGrid

How To send email with Codeigniter using SendGrid

Today, We explain to you and how to send email with Codeigniter using SendGrid. so We give you a simple example of send email with codeigniter using sendGrid.

First, we should have Sendgrid account. if you have not then you can create a new Sendgrid account. we need sendgrid_API_key so we need to sendgrid account.

Overview

Step 1: Download and install Codeigniter
Step 2: Download and Install Sendgrid Library
Step 3: Create MailSendLib Library
Step 4: Create Controller
Step 5: Create Html Mail File

Step 1: Download and install Codeigniter
We are going to install Codeigniter 3, First, we will download a fresh Codeigniter 3 version and install it in our system. You can follow the below Link to Download CodeIgniter.

Step 2: Download and Install Sendgrid Library
We need to download Sendgrid PHP libraries. so you can below command to download the Sendgrid PHP library. or you can directly download sendgrid library on the official github.

Step 3: Create MailSendLib Library
In this step, We will create the MailSendLib.php file in the “application/libraries/” directory. so you can paste the below code into this file.

Step 4: Create Controller
In this step, we will change the code  Welcome.php file in the “application/controller” directory and paste the below code into this controller.

Step 5: Create Html Mail File
So finally, we can create another file in and pass some data from the database to the “application/views/” directory. but here we are using simple files like “application/views/welcome_mail.php”.
application/views/welcome_mail.php

Please follow and like us: