voronkovich/phpmailer-dsn

该包已被废弃,不再维护。作者建议使用 phpmailer/phpmailer 包。

配置 PHPMailer 的 DSN 字符串库

资助包维护!
Ko Fi

v0.0.1 2023-02-27 19:55 UTC

This package is auto-updated.

Last update: 2023-03-09 22:25:07 UTC


README

CI

配置 PHPMailerDSN 字符串 库。

废弃了!!

此功能 已合并到 PHPMailer。请使用 PHPMailer 本身。

composer require phpmailer/phpmailer:^6.8.0

安装

composer require voronkovich/phpmailer-dsn

使用

use Voronkovich\PHPMailerDSN\DSNConfigurator;
use PHPMailer\PHPMailer\PHPMailer;

$mailer = new PHPMailer(true);
$configurator = new DSNConfigurator();

$configurator->configure($mailer, 'smtp://:2525');

配置

支持的协议

  • mail
  • sendmail
  • qmail
  • smtp
  • smtps

可以通过查询字符串应用额外的配置

$dsn = 'mail://?XMailer=SuperMailer&FromName=CoolSite';

$configurator->configure($mailer, $dsn);

PHPMailer 通过公共属性进行配置,因此您可以使用其中任何一个。所有允许的选项都可以在 PHPMailer 文档 中找到。

示例

Sendmail

$dsn = 'sendmail://?Sendmail=/usr/sbin/sendmail%20-oi%20-t';

$configurator->configure($mailer, $dsn);

SMTP

$dsn = 'smtp://user@password@localhost?SMTPDebug=3&Timeout=1000';

$configurator->configure($mailer, $dsn);

Gmail

$dsn = 'smtps://user@gmail.com:password@smtp.gmail.com?SMTPDebug=3';

$configurator->configure($mailer, $dsn);

许可证

版权 (c) Voronkovich Oleg。在 MIT 许可下分发。