Giter VIP home page Giter VIP logo

daily-hipaway-mandrill's Introduction

HipMandrillBundle

[Build Status] (http://travis-ci.org/Hipaway-Travel/HipMandrillBundle)

Send transactional mail through mandrill.com. This bundle provides an easy api for Symfony2 Projects.

All settings inside message class represent attributes of Mandrill's API. Please refer to their API documentation for Details:

https://mandrillapp.com/api/docs/messages.html

Prerequisites

Before you're able to use this bundle you must sign up with Mandrill.

http://mandrill.com

Mandrill is a great way to send your transactional emails and provides detailed advances reports.

Mandrill is free for limited number of email per day, please read through pricing section on the website for more information:

http://mandrill.com/pricing/

Installation

Add the bundle to your composer.json

# composer.json
{
 "require": {
     "hipaway-travel/mandrill-bundle": "dev-master",
 }
}

Run composer install

php ./composer.phar install

Enable the bundle in the kernel

<?php
// app/AppKernel.php

public function registerBundles()
{
    $bundles = array(
        // ...
        new Hip\MandrillBundle\HipMandrillBundle(),
    );
}

Configuration

Add configuration to config.yml.

Log in to Mandrill and go to "Settings" -> "SMTP and API Credentials". Create an API Key and use it in your Symfony2 Configuration.

# config.yml

hip_mandrill:
    api_key: xxxxx
    default:
        sender: [email protected]
        sender_name: John Doe

Now you're all set, send your first transactional mails:

Use

Simple controller Example:

<?php

// src/Hip/ExampleBundle/Controller/ExampleController.php
namespace Hip\ExampleBundle\Controller;

use Symfony\Component\HttpFoundation\Response;

use Hip\MandrillBundle\Message;
use Hip\MandrillBundle\Dispatcher;

class ExampleController
{
    public function indexAction()
    {
        $dispatcher = $this->get('hip_mandrill.dispatcher');

        $message = new Message();

        $message
            ->setFromEmail('[email protected]')
            ->setFromName('Customer Care')
            ->addTo('[email protected]')
            ->setSubject('Some Subject')
            ->setHtml('<html><body><h1>Some Content</h1></body></html>');

        $result = $dispatcher->send($message);

        return new Response('<pre>' . print_r($result, true) . '</pre>');

    }

}

daily-hipaway-mandrill's People

Contributors

ukwm-deploy 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.