simonmao / simple-mailer
基于phpmailer包的简单邮件客户端。
dev-develop
2020-07-11 12:32 UTC
Requires
- phpmailer/phpmailer: ^6.1
This package is auto-updated.
Last update: 2024-09-11 21:44:13 UTC
README
使用说明
composer require simonmao/simple-mailer
示例
邮件配置
config.yaml
email: debug: true host: smtpserver.com port: 587 username: yourname@domain.com password: password encryption: tls # tls/ssl fromEmail: yourname@domain.com fromName: "Mailer"
加载配置
$conf = Noodlehaus\Config::load('config.yaml') ->get('email');
初始化
$mailer = new \SimpleMailer\SimpleMailer($conf);
发送纯文本邮件
$bool = $mailer->sendText('xxx@email.com', 'Title', 'hello'); var_dump($bool);
发送HTML邮件
$bool = $mailer->sendHTML('xxx@email.com', 'Title', '<h1>hello</h1>'); var_dump($bool);
依赖
phpmailer/phpmailer