PHP Scripts and Development

Home » PHP Scripts » Email & Newsletter » SendGrid-CodeIgniter Pack

  • Visit:
  • Hits:
  • Views:
  • Platform(s):
  • Database(s):
  • License:
  • Price:
  • Version:
  • Script Added:
  • Last Updated:
  • Developer:
  • Script Link:
  • Tags:

Description:
This package allows you to send emails through SendGrid, store all the analytics data in your database and get spam reports to your database.

This package allows you to send emails through SendGrid, store all the analytics data in your database and get spam reports to your database.
Back to top
Installation

What you need to use this pack

You'll need a SendGrid account and CodeIgniter 2.0.

What do we have here?

At first lets get familiar with the files in that pack:

config/sendgrid.php

Stores the configurations for the email class to use when sending emails through SendGrid. Make sure to change username and password.config/sendgrid.php

controllers/eactivity.php

This is the controller that SendGrid interacts with for posting events and SPAM reports to your app.

libraries/MY_Email.php

Adds small method for defining a category for the email (for some reason CI_Email class doesn't allows to add headers on your own).

sendgrid_events.sql

This is the database table to store the events. Usually I'll use ARCHIVE engine for storing that kind of data, but 2 problems with that:

If you'll send newsletters, you'll have lots of data very quickly.
You'll probably create a page to see the events, and because not possible to add indexes in ARCHIVE (which makes navigation in that table very difficult) it will be slow.

So I chose MyISAM which has quick writing (again, very critical when sending newsletters).

Installation

Installation very easy. Run the SQL in your database and upload the files to the folders.

config/sendgrid.php -> your config folder controllers/eactivity.php -> your controllers folder libraries/MY_Email.php -> your library folder

Back to top
Sending Emails

Sending emails from your app is very easy:

// loading the config
$this->config->load('sendgrid', TRUE);
$email_config = $this->config->item('sendgrid');
$this->email->initialize($email_config);

$this->email->to("to@someone.com");
$this->email->set_category("category_in_sendgrid");
$this->email->from("info@example.com");
$this->email->subject("Subject");

$message = "Email here.."
$this->email->message($message);
$this->email->send();

For more information, see CodeIgniter doc about email library.
Back to top
Tips

There's a lot you can do with this. Using this pack, all the data and analytics will be in your database.

I recommend adding another field to the database which will store user's ID, and will be identified by the email you're getting from SendGrid,

This some of the stuff I do: If certain user's email Drops (Sendgrid response for emails that don't exists for example), I can handle it automatically by blocking him or flagging him in my app.

In an eCommerce site I built, If I get a bounce response for email from category "order_approval" -> than I flag it in that user's order so Support department will know that something was wrong with his email.

Sky is the limit here, and each application has its own needs.

Rated 0/5 (0%) (0 Votes)
 Script Name: SendGrid-CodeIgniter Pack
 Your Name:
 Your Email:
 Your Friends Name:
 Your Friends Email:
 Script Name : SendGrid-CodeIgniter Pack
 Reason :
 Message :
  Security Code:
  •  Other listings by this developer
Tranzila Payment Gateway Library
PHP Scripts » E-Commerce