germania-kg / swiftmailer-callable
1.1.5
2022-03-30 10:10 UTC
Requires
- php: ^5.6|^7.0|^8.0
- psr/log: ^1.0
- swiftmailer/swiftmailer: ^5.4|^6.0
Requires (Dev)
- php-coveralls/php-coveralls: ^2.0
- phpspec/prophecy-phpunit: ^2.0
- phpunit/phpunit: ^9.0
README
SwiftMailer发送电子邮件的调用包装器
安装
$ composer require germania-kg/swiftmailer-callable
使用
<?php use Germania\SwiftMailerCallable\SwiftMailerCallable; // Dependencies $swift_mailer = Swift_Mailer::newInstance( ... ); $message_factory = function() { return Swift_Message::newInstance( ... ); }); // Setup callable, optionally with PSR-3 Logger $mailer = new SwiftMailerCallable( $swift_mailer, $message_factory ); $mailer = new SwiftMailerCallable( $swift_mailer, $message_factory, $logger ); // PSR-3 LoggerAwareInterface $mailer->setLogger( $logger ); // Prepare sending $subject = 'My mail subject'; $body = 'Any mail text'; // Go! - Optionally pass recipient, if not already set in factory $sent = $mailer( $subject, $body ); $sent = $mailer( $subject, $body, ['me@test.com' => 'Joen Doe'] );
问题
查看问题列表。
开发
$ git clone https://github.com/GermaniaKG/SwiftMailerCallable.git
$ cd SwiftMailerCallable
$ composer install
单元测试
可以将phpunit.xml.dist
复制到phpunit.xml
并根据您的需求进行修改,或者保持不变。运行PhpUnit测试或composer脚本,如下所示:
$ composer test # or $ vendor/bin/phpunit