CodeIgniter-SendGrid-Newsletter is a CodeIgniter wrapper for the SendGrid Newsletter API.
- PHP 5.1+
- CodeIgniter 2.0.0+
- cURL
- CodeIgniter REST Client Library: http://getsparks.org/packages/restclient/show
Initialization
initialize()
- Set up the library with API credentials and settings
Newsletter
add_newsletter()
- Create a newsletteredit_newsletter()
- Edit a newsletterget_newsletter()
- Get the contents of an existing newsletterlist_newsletters()
- Retrieve a list of all newslettersdelete_newsletter()
- Delete a newsletter
Lists
add_list()
- Create a recipient listedit_list()
- Rename a listget_lists()
- Retrieve all recipient lists or check if a particular list existsdelete_list()
- Delete a list
List Emails
add_list_emails()
- Add one or more emails to a listget_list_emails()
- Retrieve the email addresses and associated fields for a particular listdelete_list_emails()
- Remove one or more emails from a list
Newsletter Lists
add_recipients()
- Add a recipient to a newsletterget_recipients()
- Retrieve the lists assigned to a particular newsletterdelete_recipients()
- Remove a list from a newsletter
Scheduling
add_schedule()
- Schedule a delivery time for an existing newsletterget_schedule()
- Retrieve the scheduled delivery time for a particular newsletterdelete_schedule()
- Cancel a scheduled send for a newsletter
Identities
add_identity()
- Create a new identityedit_identity()
- Edit an identityget_identity()
- Retrieve a particular identitylist_identities()
- Retrieve a list of all identities or check if an identity existsdelete_identity()
- Delete an identity
Errors
error_message()
- Get error message
// Load the SendGrid spark
$this->load->spark('sendgrid/0.1.1');
// Initialize (not necessary if set in config)
$this->sendgrid_newsletter->initialize(array('api_user' => 'my_username',
'api_key' => 'secret_key',
'api_format' => 'json'));
// Get newsletters
$newsletters = $this->sendgrid_newsletter->list_newsletters();