Giter Site home page Giter Site logo

mailextrabundle's Introduction

MailExtraBundle

Add transformer to your mail before sending it.

Transformers already added:

html2text

Needs binary html2text Install: brew install html2text

This transformer will create a text/plain verion of your HTML message and add it as part.

PictureEmbed

This transformer will look at picture on your html email and add pictures in embed of mail.

Add your transformer

Add it to the config.yml

rezzza_mail_extra:
    transformers:
        mytransforrmer:
            id:         service_id
            options:    [] # some options

Your service_id should implements TransformerInterface, example:

<?php

namespace MyNamespace\Transformer;

use Rezzza\MailExtraBundle\Transformer\AbstractTransformer;
use Rezzza\MailExtraBundle\Transformer\TransformerInterface;

class MyTransfrormer extends AbstractTransformer implements TransformerInterface
{
    /**
     * {@inheritdoc)
     */
    public function transform(\Swift_Mime_Message $message)
    {
        // transform message
    }

    /**
     * {@inheritdoc)
     */
    public function supports(\Swift_Mime_Message $message)
    {
        return true; // if the message is supported by this transformer ?
    }

}

Activate transformers

You can activate by default a transformer by use the default key on config.

Else, on the mailer, use:

<?php
$transformerProcessor = $this->get('rezzza.transformer.processor'); // or replace by direct definition
$transformerProcessor->activate('my_transformer'); // activate
$transformerProcessor->deactivate('my_transformer'); // deactivate

Full configuration reference:

rezzza_mail_extra:
    mailer_class: Rezzza\MailExtraBundle\Mailer\Mailer
    transformers: # list of transformers
        html2text:
            id:         rezzza.transformer.html2text # service identifier
            default:    false # is used by default on each mail
            options:    # some options
                binary: /usr/local/bin/html2text
        picture_embed:
            id:         rezzza.transformer.picture_embed

If you have any questions or improvements, create an issue or contact us.

mailextrabundle's People

Contributors

shouze avatar stephpy avatar

Watchers

 avatar  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.