machour/swiftmailer-ethereal-transport
最新稳定版本:1.0.0
Composer 安装命令:
composer require machour/swiftmailer-ethereal-transport
包简介
A simple Ethereal transport for Swift Mailer
README 文档
README
This is a simple transport for Swift Mailer that uses Ethreal, the fake SMTP service.
This transport is meant to be used while developing your application, in order to preview the message, without it getting actually sent.
Using this transport, you can set a callback that will be invoked with the URL to the message preview as its first and only argument.
Installation
composer require machour/swiftmailer-ethereal-transport
Usage
use Machour\SwiftMailerEtherealTransport\EtherealTransport; // Create the Transport $transport = (new EtherealTransport()) // Get your credential at https://ethereal.email/create ->setUsername('your username') ->setPassword('your password') // Display the URL in your logs, store it session, or whatever .. ->setCallback(function (string $url) use ($logger) { $logger->debug("Email sent to Ethereal, see it at $url"); }); // Create the Mailer using your created Transport $mailer = new Swift_Mailer($transport); // Create a message $message = (new Swift_Message('Wonderful Subject')) ->setFrom(['john@doe.com' => 'John Doe']) ->setTo(['receiver@domain.org', 'other@domain.org' => 'A name']) ->setBody('Here is the message itself'); // Send the message $result = $mailer->send($message);
Note
Note Swift Mailer is deprecated, use this extension if you're stuck with a legacy app.
See also
统计信息
- 总下载量: 3.88k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 1
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: BSD-3-Clause
- 更新时间: 2022-09-17