phicorp/mailbox
Composer 安装命令:
composer require phicorp/mailbox
包简介
mailBox: a tool for easier work with sending emails for the PHP language
README 文档
README
A tool for easier work with sending emails for the PHP language
Installation
Install Cipher with composer
composer require phicorp/mailbox
Features
- Easy to use
- HTML sending support
- SMTP support
- And more features
Usage/Examples
- Send a normal email
use mailBox\mailBox; // Create an instance of mailBox with SMTP server details. $mailer = new mailBox('smtp.example.com', 587, 'STARTTLS'); // Set SMTP authentication credentials. $mailer->auth('your_username', 'your_password'); // Set sender information. $mailer->setFrom('your_email@example.com', 'Your Name'); // Set recipient email. $mailer->to('recipient@example.com'); // Set email subject and message. $mailer->subject('Hello, World!'); $mailer->message('This is a test email sent using mailBox class.'); // Optionally, enable HTML email if needed. // $mailer->isHTML(); // Send the email. if ($mailer->send()) { echo "Email sent successfully."; } else { echo "Email sending failed."; } // Optionally, you can retrieve the logs for debugging purposes. // $logs = $mailer->getLogs();
- If you want to use PHP's own built-in functions to send your email, you can use this method
use mailBox\mailBox; // Create an instance of mailBox with SMTP server details. $mailer = new mailBox('your_smtp_host', 25, 'tls', 'your_username', 'your_password'); // Set sender information. $mailer->setFrom('your_email@example.com', 'Your Name'); // Set recipient email. $mailer->to('recipient@example.com'); // Set email subject and message. $mailer->subject('Hello, World!'); $mailer->message('<p>This is a test email sent using mailBox class.</p>'); // Enable HTML mode $mailer->isHTML(); // Send the email. $result = $mailer->sendRAW(); if ($result) { echo "Email sent successfully using default mail() function."; } else { echo "Email could not be sent using default mail() function."; }
- Sending by Outlook, with method chaining
mailBox::create('smtp.office365.com', 587) ->encryption('STARTTLS') ->auth('your_username@outlook.com', 'your_password') ->setFrom('your_username@outlook.com', 'your_name') ->to('recipient@example.com') ->subject("Hello, World!") ->message("This is a test email sent using mailBox class.") ->send();
- Sending by Gmail, with method chaining and using helper function
mailBox('smtp.gmail.com', 587) ->encryption('STARTTLS') ->auth('your_username@gmail.com', 'your_password') ->setFrom('your_username@gmail.com', 'your_name') ->to('recipient@example.com') ->subject("Hello, World!") ->message("<p>This is a test email sent using mailBox class.</p>")->isHTML() ->send();
Authors
License
phicorp/mailbox 适用场景与选型建议
phicorp/mailbox 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 77 次下载、GitHub Stars 达 2, 最近一次更新时间为 2023 年 10 月 07 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「mailbox」 「Maya」 「phi」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 phicorp/mailbox 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 phicorp/mailbox 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 phicorp/mailbox 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
Extension conversion of 'EWS' to yii2 extension
Paymaya SDK for PHP
A Laravel package to easily integrate Xendit payment gateway. It supports credit and debit cards, and e-wallet payments and custom invoices, queued notifications, webhook listeners and more.
Manage mailboxes, filter/get/delete emails in PHP (supports IMAP/POP3/NNTP)
PhpImap\Mailbox Symfony integration.
Keycloak/OIDC JWT authentication middleware for Laravel: JWKS caching, RequirePermissionMiddleware, AppToAppAuthenticator, configurable user resolver.
统计信息
- 总下载量: 77
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 2
- 点击次数: 22
- 依赖项目数: 1
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2023-10-07