scullwm/mailhookbundle 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

scullwm/mailhookbundle

最新稳定版本:3.0.2

Composer 安装命令:

composer require scullwm/mailhookbundle

包简介

A bundle to catch API webhook from differents mail service

README 文档

README

Catch webhook from various API mail service and directly get the related user.

Build Status Build Status

Features

Define your project url to your mail provider service (Mandrill, MailJet...) and get events dispatched into your app.

Support various service

  • Campain Monitor
  • Mailgun
  • Mailjet
  • Mandrill
  • Sendgrid
  • Sparkpost
  • And add your custom service

Example use cases:

  • Disable to a user's notification when a mail is signal as spam.
  • Send a private message to a user if last mail send get bounced.
  • Warning an Account Manager about a hard bounce on a new user creation.
  • Track email reading and clicks on your custom CRM.
  • All you want!

Installation

Add the package to your composer.json file

"scullwm/mailhookbundle": "dev-master",

Add this to app/AppKernel.php

<?php
    public function registerBundles()
    {
        $bundles = array(
            ...
            new Swm\Bundle\MailHookBundle\SwmMailHookBundle(),
        );

        ...

        return $bundles;
    }

Configuration

1) Edit app/config.yml

swm_mail_hook:
    secretsalt: notSecret

2) Edit app/routing.yml

swm_mailhook_controller:
    resource: "@SwmMailHookBundle/Controller/"
    type:     annotation
    prefix:   /

Well done!

Use it

Go to your email service provider like mandrillapp.com and find where to configure your webhook. Check hooks you want and set the url like this:

http://www.mywebsite.com/webhook/{secretSalt}/{serviceName}/catch

With no configuration for mandrill it should be : http://www.mywebsite.com/webhook/notSecret/mandrill/catch

With a custom secretSalt and mailjet service it should be : http://www.mywebsite.com/webhook/dDifXo26/mailjet/catch

Events dispatched

  • swm.mail_hook.event.open
  • swm.mail_hook.event.send
  • swm.mail_hook.event.click
  • swm.mail_hook.event.soft_bounce
  • swm.mail_hook.event.hard_bounce
  • swm.mail_hook.event.deferral
  • swm.mail_hook.event.spam
  • swm.mail_hook.event.blocked
  • swm.mail_hook.event.unsub
  • swm.mail_hook.event.reject
  • swm.mail_hook.event.other

Events listener provided

By default, a simple MailHookEvent is dispatched by the DefaultHydrator. But if you are using FosUserBundle, you can use the FosUserHydrator to use directly UserMailHookEvent which return directly the user entity associate on the email.

If your using FosUserBundle

There's already a special route called "swm_mailhook_user_catcher_for_service": /{secretSalt}/{service}/catchuser

It directly return a UserMailHookEvent where you can getUser().

To see a basic exemple see this link : https://gist.github.com/ScullWM/8acea9c0e229ed76717f (Using JMS/di-extra-bundle optionnal)

统计信息

  • 总下载量: 20.23k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 40
  • 点击次数: 1
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 38
  • Watchers: 3
  • Forks: 4
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2015-04-16