stephenfarrell/postmark-bundle
最新稳定版本:v0.0.6
Composer 安装命令:
composer require stephenfarrell/postmark-bundle
包简介
A minor update of Miguel Perez's no-longer maintained code from https://github.com/miguel250/PostmarkBundle to allow for Symfony 3 compatibility. All credit/kudos/thanks for the work should obviously go to him
关键字:
README 文档
README
Symfony3 bundle for Postmark API
This is a ridiculously minor update of Miguel Perez's no-longer maintained code from https://github.com/miguel250/PostmarkBundle to allow for Symfony 3 compatibility. All credit/kudos/thanks for the work should obviously go to him
Setup
Using Composer Add PostmarkBundle in your composer.json:
{ "require": { "stephenfarrell/postmark-bundle": "*" } }
$ php composer.phar update mlpz/postmark-bundle
Using Submodule
git submodule add https://github.com/miguel250/PostmarkBundle.git vendor/bundles/MZ/PostmarkBundle
git submodule add https://github.com/kriswallsmith/Buzz.git vendor/buzz
Add the MZ namespace to autoloader You can skip this when using Composer
<?php // app/autoload.php $loader->registerNamespaces(array( // ... 'MZ' => __DIR__.'/../vendor/bundles', 'Buzz' => __DIR__.'/../vendor/buzz/lib', ));
Add PostmarkBundle to your application kernel
<?php // app/AppKernel.php public function registerBundles() { $bundles = array( // ... new MZ\PostmarkBundle\MZPostmarkBundle(), ); }
Enable Postmark in config.yml
mz_postmark: api_key: API KEY from_email: info@my-app.com from_name: My App, Inc use_ssl: true timeout: 5
Usage
Message Service
<?php $message = $this->get('postmark.message'); $message->addTo('test@gmail.com', 'Test Test'); $message->setSubject('subject'); $message->setHTMLMessage('<b>email body</b>'); $message->addAttachment(new Symfony\Component\HttpFoundation\File\File(__FILE__)); $response = $message->send(); $message->addTo('test2@gmail.com', 'Test2 Test'); $message->setSubject('subject2'); $message->setHTMLMessage('<b>email body</b>'); $message->addAttachment(new Symfony\Component\HttpFoundation\File\File(__FILE__), 'usethisfilename.php', 'text/plain'); $response = $message->send(); ?>
Sending in batch
<?php $message = $this->get('postmark.message'); $message->addTo('test@gmail.com', 'Test Test'); $message->setSubject('subject'); $message->setHTMLMessage('<b>email body</b>'); $message->queue(); // Queue the message instead of sending it directly $message->addTo('test2@gmail.com', 'Test2 Test'); $message->setSubject('subject2'); $message->setHTMLMessage('<b>email body</b>'); $responses = $message->send(); // Send both messages, note that you'll get an array of json responses instead of just the json response ?>
统计信息
- 总下载量: 5.62k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2016-09-12