承接 uam/postmark-swiftmailer-bundle 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

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

uam/postmark-swiftmailer-bundle

Composer 安装命令:

composer require uam/postmark-swiftmailer-bundle

包简介

Symfony bundle to provide a Postmark SwiftMailer service

README 文档

README

A Symfony2 bundle that provides a SwiftMailer Transport implementation based on Postmark's API.

While a Symfony app by no means requires you to use SwiftMailer for sending emails, there are many benefits to doing so: log of emails sent, ability to redirect to a single delivery address during development, etc.

This bundle allows you to use the Postmark API as a SwiftMailer transport in your Symfony app. This provides you with the benefits of both SwiftMailer and of the Postmark service.

This bundle is in its early stages of development, and can hardly be viewed as production-ready. Usage in production is at your peril.

Requirements

You need an active account at https://postmarkapp.com/ and a Postmark API key.

This bundle relies on the MZPostmarkBundle and will include it automatically.

Installation

Add package to your project's composer.json:

"require": {
	"uam/postmark-swiftmailer-bundle": "dev-master",
	…
}

Register this bundle as well as the MZPostmarkBundle in AppKernel.php:

public function registerBundles()
{
	bundles = (
		// …
		new MZ\PostmarkBundle\MZPostmarkBundle(),
		new UAM\Bundle\PostmarkSwiftMailerBundle\UAMPostmarkSwiftMailerBundle(),
	);
	
	return bundles();
}

Configuration

Configure the MZPostmarkBundle as per that bundle's documentation:

# app/config/config.php

mz_postmark:
    api_key:    %postmark_api_key%
    from_email: %postmark_from_email%
    from_name:  %postmark_from_name%
    use_ssl:    %postmark_use_ssl%
    timeout:    %postmark_timeout%

Update your SwiftMailer configuration to use the uam_postmark SwiftMailer transport provided by this bundle.

# app/config.php
swiftmailer:
	transport: uam_postmark

There is no configuration specific to this bundle.

Usage

This bundle creates a service aliased uam_postmark which implements a SwiftMailer transport based on the Postmark API.

Create your SwiftMailer messages as usual. When sent, the messages will be routed through the uam_postmark transport to the Postmark servers.

SwitfMailer plugins

The UAMPostmarkTransport should in theory be able to support all swiftmailer plugins. However, so far only the Redirecting plugin has been tested to some extent.

Redirecting

Edit your swiftmailer configuration as per the symfony SwiftMailerBundle documentation:

# app/config.php
swiftmailer:
	delivery_address: test@example.com

Known issues

HTML message content shows up as raw text

Make sure that the HTML body in your emails are set as a MIME part:

$message
    ->addPart($htmlBody, 'text/html');

Email count

The Swift_Transport#send() method returns the count of messages sent.

This bundle's implementation will return the number of emails sent to recipients included in the 'To' header. Emails sent to 'Cc' and 'Bcc' recipients will not be included in the email count returned.

The reason for this is that the Postmark API, while supporting Cc and Bcc recipients, does not seem to include any data about them in its response to a request to send a message.

Failed recipients

The Swift_Transport#send() method's second parameter is designed to be passed a variable which collects the email addresses of failed recipients.

This is not supported by this bundle's implementation of the Swift_Transport interface. By design, this implementation will make a single call to the Postmark API for all the recipients (To, Cc, and Bcc included included in a single call, as opposed to a call per recipient). This single call will fail if one of the email addresses is invalid.

Redirecting custom headers are lost

SwiftMailer's Redirecting plugin adds custom headers to your message to reflect the original recipients ('X-Swift-To', 'X-Swift-Cc', 'X-Swift-Bcc'). These headers are not recognized by the Postmark API and are not retained in the actual message sent via Postmark.

uam/postmark-swiftmailer-bundle 适用场景与选型建议

uam/postmark-swiftmailer-bundle 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 2.91k 次下载、GitHub Stars 达 2, 最近一次更新时间为 2013 年 05 月 29 日, 在 PHP 生态内属于活跃度较高的组件。

它主要适用于以下技术方向: 「symfony」 「bundle」 「swiftmailer」 「postmarkapp」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。

我们在过去多个企业项目中使用过 uam/postmark-swiftmailer-bundle 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。

围绕 uam/postmark-swiftmailer-bundle 我们能提供哪些服务?
定制开发 / 二次开发

基于 uam/postmark-swiftmailer-bundle 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。

BUG 修复 & 性能优化

线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。

项目外包 & 长期维护

承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。

yvsm@zunyunkeji.com QQ:316430983 微信:yvsm316 西安尊云信息科技 · 专注 PHP / Go / 分布式系统研发

统计信息

  • 总下载量: 2.91k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 2
  • 点击次数: 12
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 2
  • Watchers: 1
  • Forks: 2
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2013-05-29