GithubHelp home page GithubHelp logo

smoovej / sendgrid-component Goto Github PK

View Code? Open in Web Editor NEW

This project forked from damusnet/sendgrid-component

0.0 1.0 0.0 87 KB

A very simple component to use the Sendgrid API inside CakePHP

PHP 100.00%

sendgrid-component's Introduction

Sendgrid CakePHP component

Copyright 2011, Damien Varron Licensed under The MIT License Redistributions of files must retain the above copyright notice.

Version

Written for CakePHP 1.3+

Configuration

Add the following lines to your core configuration file with your own credentials:

Configure::write('Sendgrid.username', '[email protected]');
Configure::write('Sendgrid.password', 'yourpassword');

Usage

This component extends the base CakePHP email component, and works virtually the same.

Place the sendgrid.php file in your app/controllers/components/ folder.

In your controller, make sure the component is available:

public $components = array('Sendgrid');   

Then, simply send messages like this:

$this->Sendgrid->delivery = 'sendgrid';
$this->Sendgrid->from = '[email protected]';
$this->Sendgrid->to = '[email protected]';
$this->Sendgrid->subject = 'this is the subject';
$messageBody = 'this is the message body';
$this->Sendgrid->send($messageBody);

The syntax of all parameters is the same as the default CakePHP email component:

http://book.cakephp.org/view/1283/Email

For more information, see the Sendgrid API documentation:

http://sendgrid.com/documentation/display/api/WebMail

Debugging

You can see the response from Sendgrid in the return value when you send a message:

$result = $this->Sendgrid->send($messageBody);
$this->log($result, 'debug');

sendgrid-component's People

Contributors

damusnet avatar smoovej avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.