phore/mail
最新稳定版本:v0.1.5
Composer 安装命令:
composer require phore/mail
包简介
README 文档
README
A template wrapper around the famous PHPMailer Mailer class and the text/template template system.
- Single Class
- Multipart Mime
- Testing using mailtrap.io
Demo template
{mail to="abc@abc.de" name="Some Name"}
{mail from="sender@address.de" name="Me"}
{mail cc="mail@email" name="Some Name"}
{mail bcc="mail@email" name="Some Name"}
{subject}Hello {=name} - You are the welcome{/subject}
{html}
<body>
<b>Hello {= name}</b>,
<p>
This HTML Mime Mail
</p>
</body>
{/html}
Hello {= name},
This is the alternative Text body
Available mail parameters
| Parameter | Name | Default |
|---|---|---|
charset |
||
to |
||
from |
||
cc |
||
bcc |
Script for sending a mail
With auto-failover to second SMTP-Server.
$mailer = new PhoreMailer(); $mailer->config([ "Host" => "smtp1.example.org;smtp2.example.org", "Username" => "user@example.org", "Password" => "secret", "SMTPAuth" => true ]); $mailer->send($templateText, ["name"=>"Joe Doe"]);
Installation
composer require phore/mail
Configuring PHPMailer / text-template
$mailer = new PhoreMailer(); $mailer->phpmailer->phpMailerFunction();
$mailer = new PhoreMailer(); $mailer->textTemplate->textTemplateFunction();
Sending mail without mailserver using SMTP
This method is for testing only. Most Mailservers will reject mail transferred with this method.
Demos
Debugging
Instead of sending the mail, you can retrieve the PHPMailer
instance by calling prepare().
$phpmail = $phoreMailer->prepare($template,[]);
print_r ($phpmail);
$phpmail->Send();
Intercepting outgoing mail
$mailer->setSendMailFunction(function (PHPMailer $mail, PhoreMailer $phoreMailer) { $res["to"] = $mail->getAllRecipientAddresses(); $res["subject"] = $mail->Subject; $res["html"] = $mail->Body; $res["text"] = $mail->AltBody; });
统计信息
- 总下载量: 8.63k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 2
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2018-07-25