郵件應(yīng)用插件,支持在webman-admin中設(shè)置賬號(hào)信息。用于向用戶(hù)發(fā)送郵件,例如產(chǎn)品推廣、郵箱驗(yàn)證等。
use plugin\email\api\Email;
Email::send($from, $to, $subject, $content);
提示
v1.0.1新增
use plugin\email\api\Email;
Email::sendByTemplate($to, $templateName, array $templateData = [])
模版可在郵件后臺(tái)添加
use plugin\email\api\Email;
$mailer = Email::getMailer();
$mailer->setFrom('from@example.com', 'Mailer');
$mailer->addAddress('joe@example.net', 'Joe User'); // 增加一個(gè)接受者
$mailer->addAddress('ellen@example.com'); // 名字是可選的
$mailer->addReplyTo('info@example.com', 'Information');
$mailer->addCC('cc@example.com');
$mailer->addBCC('bcc@example.com');
// 附件
$mailer->addAttachment('/var/tmp/file.tar.gz'); // 添加附件
$mailer->addAttachment('/tmp/image.jpg', 'new.jpg'); // 附件名是可選的
// 內(nèi)容
$mailer->isHTML(true); // 如果內(nèi)容是html
$mailer->Subject = 'Here is the subject';
$mailer->Body = 'This is the HTML message body <b>in bold!</b>';
$mailer->AltBody = 'This is the body in plain text for non-HTML mail clients';
$mailer->send();
請(qǐng)?jiān)?a href="http://wtbis.cn/app/view/admin">webman-admin的插件市場(chǎng)安裝
注意
此插件依賴(lài)phpmailer/phpmailer
執(zhí)行命令composer require phpmailer/phpmailer
安裝(需要restart重啟)