GithubHelp home page GithubHelp logo

stampie / stampie-bundle Goto Github PK

View Code? Open in Web Editor NEW
26.0 4.0 5.0 90 KB

Home Page: https://stampie.github.io/

License: MIT License

PHP 71.61% Twig 28.39%
php symfony symfony-bundle stampie mailer bundle hacktoberfest

stampie-bundle's Introduction

StampieBundle

CI

Integrates Stampie with Symfony.

$ composer require stampie/stampie-bundle

Usage

Add Stampie\StampieBundle\StampieBundle() to your AppKernel.php in the registerBundles method.

Add the configuration to config.yml as follows

stampie:
    mailer: postmark # [send_grid, postmark, mailgun, mandrill, mailjet, spark_post] are supported
    server_token: POSTMARK_API_TEST # Replace with your ServerToken for your Service

The HttpClient used by the bundle is configurable. By default, it uses the service httplug.client, which is the name of the default HTTP client when using HttplugBundle. Using this bundle is optional. You can provide your own service integrating HTTPlug:

stampie:
    http_client: my_http_client

StampieExtra

This bundles allows you to use StampieExtra easily: add the extra library in your project. The integration is activated automatically to wrap the mailer in the extra mailer dispatching events. An integration with the profiler is also provided.

If you want to enable the ImpersonateListener to send all emails to the same address, provide a non-empty delivery address:

stampie:
    extra:
        delivery_address: [email protected]

stampie-bundle's People

Contributors

adrienbrault avatar fbourigault avatar henrikbjorn avatar kbond avatar lctrs avatar nyholm avatar pulse00 avatar stloyd avatar stof avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

stampie-bundle's Issues

Cannot Use Mandrill mailer as a dependency because it is abstract

Hello everyone.

I am trying to implement the bundle to use Mandrill, but I am getting the following error

The definition "my_project.mailer.mailer" has a reference to an abstract definition "hb_stampie.mailer.mandrill". Abstract definitions cannot be the target of references.

I have a mailers.yml where I define my services:

parameters:
    my_project.mailer.sender_name: My Project
    my_project.mailer.deploy_instance: my_project
services:
    my_project.mailer.buzz.client:
        class: Buzz\Client\Curl
    my_project.mailer.buzz.factory:
        class: Buzz\Message\Factory\Factory
    buzz:
        class: Buzz\Browser
        arguments:
            - '@my_project.mailer.buzz.client'
            - '@my_project.mailer.buzz.factory'
    my_project.mailer.mailer:
        class: MyProject\MailerBundle\Mailer\Mailer
        arguments:
            - '@hb_stampie.mailer.mandrill'
            - '@templating'
            - %my_project.mailer.sender_name%
            - %my_project.mailer.deploy_instance%

My config.yml goes like this:

hb_stampie:
    adapter: buzz
    mailer: mandrill
    server_token: '%mandrill_api_key%'
    extra:
        delivery_address: '%mailer_delivery_address%'

And my service MyProject\MailerBundle\Mailer\Mailer goes like this (I put only the constructor function)

namespace MyProject\MailerBundle\Mailer;

use MyProject\WebBundle\Entity\Member;
use Stampie\Identity;
use Stampie\MailerInterface as StampieMailerInterface;

class Mailer implements MailerInterface
{
    private $mailer;
    private $twig;
    private $defaultSenderName;
    private $deployInstance;

    /**
     * @param StampieMailerInterface $mailer
     * @param \Twig_Environment        $twig
     * @param string                             $defaultSenderName
     * @param string                             $deployInstance
     */
    public function __construct(StampieMailerInterface $mailer, \Twig_Environment $twig, $defaultSenderName, $deployInstance)
    {
        $this->mailer = $mailer;
        $this->twig = $twig;
        $this->defaultSenderName = $defaultSenderName;
        $this->deployInstance = $deployInstance;
    }
}

My MailerInterface (implemented by MyProject\MailerBundle\Mailer\Mailer) is simply the following:

namespace MyProject\MailerBundle\Mailer;

interface MailerInterface
{
    /**
     * Sends a mail to the recipient(s) using the template.
     *
     * The template must define 3 blocks: subject, body_text and body_html.
     *
     * @param Message $message
     */
    public function send(Message $message);
}

Now if I look in the config.xml of the henrikbjorn bundle, I do have
<service id="hb_stampie.mailer.mandrill" class="%hb_stampie.mailer.mandrill.class%" abstract="true" />
which means that the hb_stampie.mailer.mandrill is an abstract class.

What am I missing in the configuration here? What should I do to be able to use Mandrill to send my mails?

Please tag a new stable version of the bundle

A nasty bug exists in the 1.0.0 release. It has been fixed 2 days later but this fix is unreleased, which means that Composer users relying on stable versions won't get it. Please tag the 1.0.1 release

SpoolMailer configuration

Hi,

what is the best way to configure SpoolMailer or is it not yet supported by the bundle?

Thanks for help!

Collecting Data not getting messages...

Hi guys!

While implementing Stampie for a given project, I faced the case where the DataCollector was not getting messages from the MessageLogger.

I overrided MessageLogger and StampieDataCollector in order to add a logger service.

The MessageLogger:preSend is well called, as far as I saw in my logs. When logging data from the DataCollector:collect, it seems there are no messages... Should I do something specific here?

Thanks for your time and help!

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.