developarts/nomad_mimemail
Composer 安装命令:
composer require developarts/nomad_mimemail
包简介
Nomad MIME Mail, is a PHP class for handling and sending mail MIME type, with support for the dispatch by SMTP and SMTP Auth
关键字:
README 文档
README
Nomad MIME Mail, is a PHP class for handling and sending mail MIME type, with support for the dispatch by SMTP and SMTP Auth
Description.
Currently, this class supports:
- Plain Text
- HTML
- Plain Text with Attachments
- HTML with Attachments
- HTML with Embedded Images
- HTML with Attachments and Embedded Images
It also supports multiple e-mail addresses for sending (to), with a copy (cc) and with a blind carbon copy (bcc), as well as several images embedded in HTML and various attachments
Quick Reference.
Attached to this class and documentation is a file called 'nomad_mimemail.test.php' where is a script with an example of sending mail with text, HTML, Image and Deputy Embedded sent via SMTP. .
To use MIME Mail Nomad is necessary to declare the object as follows:
include ('nomad_mimemail.inc.php'); $mimemail = new nomad_mimemail();
Plain Text.
Normally this is how the function 'mail ()' would operate. PHP, however in this version is created so a little different because it sent the body of the message headers and MIME type
$mimemail->set_from("me@mail.com"); $mimemail->set_to("friend@mail.com"); $mimemail->set_subject("Nomad MIME Mail: Plain Text"); $mimemail->set_text("This is a MIME Mail with:\n\n- Plain Text"); if ($mimemail->send()) { echo "The MIME Mail has been sent"; } else { echo "An error has occurred, mail was not sent"; }
Plain Text and HTML.
Example of sending mail with text and HTML
$mimemail->set_from("me@mail.com"); $mimemail->set_to("friend@mail.com"); $mimemail->set_subject("Nomad MIME Mail: Plain Text + HTML"); $mimemail->set_text("This is a MIME Mail with:\n\n- Plain Text\n- HTML"); $mimemail->set_html("<HTML><HEAD></HEAD><BODY>This is a <b>MIME</b> Mail with:<BR><BR>- Plain Text</BR>- HTML</BODY></HTML>"); if ($mimemail->send()) { echo "The MIME Mail has been sent"; } else { echo "An error has occurred, mail was not sent"; }
Plain Text with Attachments.
Example of creating an email with an attachment and Plain Text. You can do more than adding attachments with the 'add_attachment' method. For more information, check the function reference guide.
$mimemail->set_from("me@mail.com"); $mimemail->set_to("friend@mail.com"); $mimemail->set_subject("Nomad MIME Mail: Plain Text + Attachment"); $mimemail->set_text("This is a MIME Mail with:\n\n- Plain Text\n- Attachment"); $mimemail->add_attachment("test_attachment.tar.gz", "file.tar.gz"); if ($mimemail->send()) { echo "The MIME Mail has been sent"; } else { echo "An error has occurred, mail was not sent"; }
Plain Text and HTML with Attachments
Example to create an email with Plain Text, HTML and a deputy. You can add more than one attachment using the 'add_attachment'.
$mimemail->set_from("me@mail.com"); $mimemail->set_to("friend@mail.com"); $mimemail->set_subject("Nomad MIME Mail: Plain Text + HTML + Attachment"); $mimemail->set_text("This is a MIME Mail with:\n\n- Plain Text\n- HTML\n- Attachment"); $mimemail->set_html("<HTML><HEAD></HEAD><BODY>This is a <b>MIME</b> Mail with:<BR><BR>- Plain Text</BR>- HTML</BR>- Attachment</BODY></HTML>"); $mimemail->add_attachment("test_attachment.tar.gz", "file.tar.gz"); if ($mimemail->send()) { echo "The MIME Mail has been sent"; } else { echo "An error has occurred, mail was not sent"; }
Plain Text and HTML with Embedded Images
Example of creating an email with HTML, plain text and an Embedded Image. For the image embedded function, the attachment must have the same name as indicated on the tag 'IMG' HTML message.
$mimemail->set_from("me@mail.com"); $mimemail->set_to("friend@mail.com"); $mimemail->set_subject("Nomad MIME Mail: Plain Text + HTML + Embedded Image"); $mimemail->set_text("This is a MIME Mail with:\n\n- Plain Text\n- HTML\n- Embedded Image"); $mimemail->set_html("<HTML><HEAD></HEAD><BODY>This is a <b>MIME</b> Mail with:<BR><BR>- Plain Text</BR>- HTML</BR>- Embedded Image</BR></BR><img src='image.gif' border='0'></BODY></HTML>"); $mimemail->add_attachment("test_image.gif", "image.gif"); if ($mimemail->send()) { echo "The MIME Mail has been sent"; } else { echo "An error has occurred, mail was not sent"; }
Plain Text and HTML with Embedded Image and Attachments
Example of creating an email with HTML, plain text, an embedded image and an attachment. For the embedded image to work, the attachment archive must have the same name as indicated on the tag 'IMG'
$mimemail->set_from("me@mail.com"); $mimemail->set_to("friend@mail.com"); $mimemail->set_subject("Nomad MIME Mail: Plain Text + HTML + Embedded Image + Attachment"); $mimemail->set_text("This is a MIME Mail with:\n\n- Plain Text\n- HTML\n- Embedded Image\n- Attachment"); $mimemail->set_html("<HTML><HEAD></HEAD><BODY>This is a <b>MIME</b> Mail with:<BR><BR>- Plain Text</BR>- HTML</BR>- Embedded Image</BR>- Attachment</BR></BR><img src='image.gif' border='0'></BODY></HTML>"); $mimemail->add_attachment("test_image", "image.gif"); $mimemail->add_attachment("test_attachment.tar.gz", "file.tar.gz"); if ($mimemail->send()) { echo "The MIME Mail has been sent"; } else { echo "An error has occurred, mail was not sent"; }
Sending Authenticated SMTP
To send mail via SMTP it is necessary to call the 'set_smtp_host' method and to send mail using SMTP authentication it is necessary to use the 'set_smtp_auth' method.
$mimemail->set_from("me@mail.com"); $mimemail->set_to("friend@mail.com"); $mimemail->set_subject("Nomad MIME Mail: HTML + Auth SMTP"); $mimemail->set_html("<HTML><HEAD></HEAD><BODY>This is a <b>MIME</b> Mail with:<BR><BR>- Plain Text</BR>- HTML</BODY></HTML>"); $mimemail->set_smtp_host("domain.com"); $mimemail->set_smtp_auth("user", "pass"); if ($mimemail->send()) { echo "The MIME Mail has been sent"; } else { echo "An error has occurred, mail was not sent"; }
At the moment this version is in testing and would appreciate any assistance possible to support such a large amount of SMTP's. If you have a mistake is possible to review the entire conversation that makes this script with SMTP. to do so before the 'send' call to the function 'set_smtp_log' a true, and the verdict can bring everything through 'get_smtp_log' as illustrated below:
$mimemail->set_smtp_log(true); if ($mimemail->send()) { echo "The MIME Mail has been sent"; } else { echo $mimemail->get_smtp_log(); }
If so, I ask you to leave your report in The Forum where this kind of try to adapt as much as possible the response received from SMTP.
Stats
developarts/nomad_mimemail 适用场景与选型建议
developarts/nomad_mimemail 是一款 基于 HTML 开发的 Composer 扩展包,目前已累计 31 次下载、GitHub Stars 达 2, 最近一次更新时间为 2015 年 05 月 13 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「mail」 「php」 「mime」 「smtp」 「attachment」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 developarts/nomad_mimemail 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 developarts/nomad_mimemail 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 developarts/nomad_mimemail 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
A PHP class providing static methods for reading, writing, copying, moving, and deleting files and directories, MIME type detection, image size detection, and file permission management
Parse a generic mail stream, and convert it to a SwiftMailer Message
Send messages via Mailgun and synchronise with Mailgun Events API.
Courier offers a convenient and painless solution for creating emails tailored for your Kirby website.
Zend Framework 1 Mime package
Mail libraries used by Zimbra Api
统计信息
- 总下载量: 31
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 2
- 点击次数: 24
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: AGPL-3.0-or-later
- 更新时间: 2015-05-13