genkgo/mail
Composer 安装命令:
composer require genkgo/mail
包简介
Library to send e-mails over different transports and protocols (like SMTP and IMAP) using immutable messages and streams. Also includes SMTP server.
README 文档
README
While analyzing what mail library to use when refactoring a code base, we discovered that the available ones are mostly legacy libraries. Some do not use namespaces and every library we encountered was merely a collection of scalar property bags than objects using encapsulation. Although we used these libs with joy in the past, they do not meet current quality standards. So, we built a new and better library according to modern programming principles.
Use this if you want to send e-mails over different transports and protocols using immutable messages and streams.
Send message quick and easy
use Genkgo\Mail; $message = (new Mail\MessageBodyCollection('<html><body><p>Hello World</p></body></html>')) ->withAttachment(new Mail\Mime\FileAttachment('/order1.pdf', new Mail\Header\ContentType('application/pdf'))) ->createMessage() ->withHeader(new Mail\Header\Subject('Hello World')) ->withHeader(Mail\Header\From::fromEmailAddress('from@example.com')) ->withHeader(Mail\Header\To::fromSingleRecipient('to@example.com', 'name')) ->withHeader(Mail\Header\Cc::fromSingleRecipient('cc@example.com', 'name')); $transport = new Mail\Transport\SmtpTransport( Mail\Protocol\Smtp\ClientFactory::fromString('smtp://user:pass@host/')->newClient(), Mail\Transport\EnvelopeFactory::useExtractedHeader() ); $transport->send($message);
Install using composer
$ composer require genkgo/mail
Features
- Use SMTP or mail() to send messages
- Use IMAPv4 to read messages from your mailbox (no extension required)
- Create replies and forward messages, including quoting of original message
- Queue messages when transport fails
- Automatically connects and reconnects after interval to SMTP server
- Automatically generate alternative text for formatted messages
- Optimal encoded headers, so no excessive (Q/B) encoded headers
- Optimal encoded multipart messages
- Only streams and connections are mutable
- Messages and actors are immutable
- Value objects protect against invalid states
- Streams make sure the library has a low memory burden
- Many objects but still easy API
- 90%+ test coverage
- Uses highest PHPStan detection level
- Only uses TLS < 1.2 if not otherwise possible
- Discourages SSL
- DKIM signed message
- Security is highly prioritized
- SMTP server for testing purposes
- Great RFC compliance
- Cast messages to valid string source
- Library has no external dependencies (but uses intl extension)
- Only supports PHP versions that are not EOL
Upcoming features
- Encrypted and signed messages
Not planned
The following features are not planned for development by the owners, but could become part of the library when initiative is taken by the community.
- POP Support
- Mailbox abstraction layer
Documentation
RFC-compliance
This library tends to be as compliant with e-mail RFCs as possible. It should be compliant with the following RFCs.
- RFC 821, Simple Mail Transfer Protocol
- RFC 1896, The text/enriched MIME Content-type
- RFC 2822, Internet Message Format
- RFC 2045, Multipurpose Internet Mail Extensions (MIME) Part One
- RFC 2046, Multipurpose Internet Mail Extensions (MIME) Part Two
- RFC 2047, Multipurpose Internet Mail Extensions (MIME) Part Three
- RFC 2048, Multipurpose Internet Mail Extensions (MIME) Part Four
- RFC 2049, Multipurpose Internet Mail Extensions (MIME) Part Five
- RFC 2392, Content-ID and Message-ID Uniform Resource Locators
- RFC 2821, Simple Mail Transfer Protocol
- RFC 3501, Internet Message Access Protocol - version 4rev1
- RFC 4954, SMTP Service Extension for Authentication
- RFC 5321, Simple Mail Transfer Protocol
- RFC 6530, Overview and Framework for Internationalized Email
Credits
This library was not able to exist without Zend/Mail and PHPMailer.
genkgo/mail 适用场景与选型建议
genkgo/mail 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 78.83k 次下载、GitHub Stars 达 402, 最近一次更新时间为 2017 年 06 月 05 日, 在 PHP 生态内属于活跃度较高的组件。
我们在过去多个企业项目中使用过 genkgo/mail 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 genkgo/mail 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
统计信息
- 总下载量: 78.83k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 402
- 点击次数: 27
- 依赖项目数: 1
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2017-06-05