misarji/ez-mail
Composer 安装命令:
composer require misarji/ez-mail
包简介
Integration of various email service providers in the Zend Framework Zend\Mail
关键字:
README 文档
README
Created by Keshav Mishra
Note that API calls are not currently unit-tested (although we have properly test them manually). Therefore, you are encouraged to test your API usage before going into production.
Introduction
EzMail is a module that integrates with various third-parties API to send mails. Integration is provided with the API of those services. It does not handle SMTP.
Please note that EzMail only supports Transactional services. Services for campaign marketing emails (like MailChimp or MailJet) are out-of-the scope of this module.
Here are the currently supported services:
- Amazon SES (nearly complete)
- Elastic Email (complete)
- Mailgun (complete)
- Mandrill (complete)
- Postmark (complete)
- Postage (complete)
- Send Grid (nearly complete)
Requirements
- PHP 5.3
- Zend Framework 2
- Amazon AWS ZF 2 Module: only if you plan to use Amazon SES service
Installation
Add "misarji/ez-mail" to your composer.json file and update your dependencies. Enable EzMail in your
application.config.php. To use one of the transport layers, see the documentation in the docs folder.
If you do not have a composer.json file in the root of your project, copy the contents below and put that into a
file called composer.json and save it in the root of your project:
{
"require": {
"misarji/ez-mail": "~1.5"
}
}
Then execute the following commands in a CLI:
curl -s http://getcomposer.org/installer | php
php composer.phar install
Now you should have a vendor directory, including a misarji/ez-mail. In your bootstrap code, make sure
you include the vendor/autoload.php file to properly load the EzMail module.
Amazon SES
If you want to use Amazon SES, you need to install the official AWS ZF 2 module. Please refer to the documentation of Amazon SES in the docs folder.
Documentation
Documentation for EzMail is splitted for each provider:
Cook-book
How to send an HTML email ?
Every email providers used in EzMail allow to send HTML emails. However, by default, if you set the mail's content
using the setBody content, this content will be considered as the plain text version as shown below:
$message = new \Zend\Mail\Message(); // This will be considered as plain text message, even if the string is valid HTML code $message->setBody('Hello world');
To send a HTML version, you must specify the body as a MimeMessage, and add the HTML version as a MIME part, as shown below:
$message = new \Zend\Mail\Message(); $htmlPart = new \Zend\Mime\Part('<html><body><h1>Hello world</h1></body></html>'); $htmlPart->type = "text/html"; $textPart = new \Zend\Mime\Part('Hello world'); $textPart->type = "text/plain"; $body = new \Zend\Mime\Message(); $body->setParts(array($textPart, $htmlPart)); $message->setBody($body);
For accessibility purposes, you should always provide both a text and HTML version of your mails.
How to configure HttpClient with http_options and http_adapter
By defaut the adapter is Zend\Http\Client\Adapter\Socket but you can override it with other adapter like this in your ez_mail.*.local.php
'ez_mail' => array( // Here your email service provider options 'http_adapter' => 'Zend\Http\Client\Adapter\Proxy' // for example )
If you want to change some options of your adapter please refer to you adapter class in var $config here and override these in your ez_mail.*.local.php like this :
'ez_mail' => array( // Here your email service provider options // example for Socket adapter 'http_options' => array( 'sslverifypeer' => false, 'persistent' => true, ), )
Which provider should I choose?
We won't answer you :-)! Each provider have their own set of features. You should carefully read each website to discover which one suit your needs the most.
However, for convenience purpose, we have wrapped a pricing table for each email provider!
misarji/ez-mail 适用场景与选型建议
misarji/ez-mail 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 590 次下载、GitHub Stars 达 0, 最近一次更新时间为 2015 年 02 月 23 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「email」 「zf2」 「postmark」 「sendgrid」 「mandrill」 「mailgun」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 misarji/ez-mail 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 misarji/ez-mail 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 misarji/ez-mail 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
LosLog provides some log utility
PHP Library to send email across all platforms using one interface.
EdpModuleLayouts is very simple Laminas module for making module-specific layouts insanely easy.
Provides an email provider for postmarkapp.com
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
Zend Framework module to leverage the symfony dependency injection container
统计信息
- 总下载量: 590
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 22
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: BSD-3-Clause
- 更新时间: 2015-02-23