weew / app-swift-mailer
将 swiftmailer/swiftmailer 集成到 weew/app 包中。
v1.1.1
2016-07-21 11:17 UTC
Requires
- swiftmailer/swiftmailer: ^5.4
- weew/app: ^2.10
Requires (Dev)
- henrikbjorn/phpspec-code-coverage: ^2.0
- phpspec/phpspec: ^2.4
- satooshi/php-coveralls: ^0.6.1
- weew/helpers-phpspec: ^1.0
This package is not auto-updated.
Last update: 2024-09-10 21:31:40 UTC
README
目录
安装
composer require weew/app-swift-mailer
简介
此包将 swiftmailer/swiftmailer 库集成到 weew/app 包中。
用法
为了在您的应用中使用 SwiftMailer,只需在 kernel 上注册 SwiftMailerProvider
即可。
$app->getKernel()->addProviders([ SwiftMailerProvider::class ]);
您可以通过配置名称获取特定的邮件发送器,如下所示
$swiftMailerManager = $app->getContainer()->get(ISwiftMailerManager::class); // returns the default mailer $swiftMailerManager->getMailer(); // returns a mailer using the specific config $swiftMailerManager->getMailer('config1');
示例配置
目前支持传输方式有 null
,sendmail
,smtp
。您的配置可能如下所示
swift_mailer: transports: # this is the default transport that is used in case no # mailer config name has been specified default: "{swift_mailer.transports.config2}" config1: type: smtp # server settings host: localhost port: 25 security: tls # server username and password username: password: config2: type: sendmail # override for the used sendmail command command: