micc83 / mailamie
用于测试的捕获所有SMTP服务器
1.1.0
2022-03-08 11:03 UTC
Requires
- php: ^7.4|^8.0
- ext-fileinfo: *
- ext-json: *
- ext-mbstring: *
- cboden/ratchet: ^0.4.3
- react/event-loop: ^1.2
- react/http: ^1.2
- symfony/console: ^5.1
- symfony/event-dispatcher: ^5.1
- zbateson/mail-mime-parser: ^2.2
Requires (Dev)
- friendsofphp/php-cs-fixer: ^3.0
- phpmailer/phpmailer: ^6.1
- phpstan/phpstan: ^1.4.8
- phpunit/phpunit: ^9
- ratchet/pawl: ^0.4.1
- react/child-process: ^0.6.1
- dev-main
- 1.1.0
- 1.0.5
- 1.0.4
- 1.0.3
- 1.0.2
- 1.0.1
- 1.0.0
- dev-dependabot/npm_and_yarn/webpack-5.76.1
- dev-dependabot/npm_and_yarn/minimist-1.2.8
- dev-dependabot/npm_and_yarn/json5-1.0.2
- dev-dependabot/npm_and_yarn/loader-utils-1.4.2
- dev-dependabot/npm_and_yarn/terser-4.8.1
- dev-dependabot/npm_and_yarn/async-2.6.4
- dev-dependabot/npm_and_yarn/node-forge-1.3.0
This package is auto-updated.
Last update: 2024-09-15 01:25:15 UTC
README
Mailamie
用于测试的捕获所有SMTP服务器
索引
为什么
有时,你可能只需要一个简单的工具来验证某个没有测试或者环境非常复杂的旧项目是否向正确的人发送了正确的电子邮件。当然,市面上有很多有效的工具可以完成这项工作,但由于这不是每天都在发生的事情,所以安装这些工具会相当麻烦。
Mailamie 是我在暑假期间的一个副项目,用来玩异步PHP。使用它就像在你的项目中设置一些参数一样简单
# Ex. Laravel .env file MAIL_MAILER=smtp MAIL_HOST=127.0.0.1 MAIL_PORT=8025 MAIL_ENCRYPTION=null
然后运行以下命令
$ mailamie
如何
Mailamie 是一个相当简单的本地测试用的捕获所有SMTP服务器,完全用PHP编写,基于ReactPhp团队所做的一项伟大工作ReactPhp。
它绝不是更完整工具的替代品,例如Mailhog,因为它实际上并不检查SMTP实现细节,而只关注获取电子邮件的标题和正文,以进行高级的交付测试。
不要在生产环境中使用。Mailamie启动了三个不同的服务器(SMTP在8025端口,HTTP在8080端口,WebSocket在1338端口)。没有采取措施来保护任何三个端口。此外,应该阻止对这些端口的远程访问。
Mailamie 可以直接从命令行使用
或者,为了更好的用户体验,在浏览器中使用
安装
Mailamie 需要 PHP ^7.4。要在系统上全局安装它,请运行以下命令进行安装
composer global require micc83/mailamie
使用
运行以下命令以获取帮助
mailamie --help
输出将如下所示
Description: Mailamie is catch all SMTP server for testing. Usage: mailamie [options] mailamie --host=127.0.0.1 --port=25 Ex. SMTP Host definition Options: -H, --host=HOST Set the host on which to listen for calls -p, --port=PORT Set the port on which to listen for SMTP calls -h, --help Display this help message -q, --quiet Do not output any message -V, --version Display this application version --ansi Force ANSI output --no-ansi Disable ANSI output -n, --no-interaction Do not ask any interactive question -v|vv|vvv, --verbose Increase the verbosity of messages: 1 for normal output, 2 for more verbose output and 3 for debug Help: You can define custom configuration from the file ~/.mailamie.config.php, check the project readme file at https://github.com/micc83/mailamie for all the available settings.
设置
您可以在 ~/.mailamie.config.php
中定义默认设置,为此请运行
$ touch ~/.mailamie.config.php && vim ~/.mailamie.config.php
此文件返回一个包含以下可用设置的PHP数组。
<?php return [ 'smtp' => [ 'host' => '127.0.0.1', 'port' => '8025' ], 'http' => [ 'host' => '127.0.0.1', 'port' => '8080' ], 'websocket' => [ 'host' => '127.0.0.1', 'port' => '1338' ], ];
最好只定义所需的设置,以防在升级后发生变化。