25/07
2018
dev-master
9999999-dev
MIT
The Requires
The Development Requires
Wallogit.com
2017 © Pedro Peláez
A template wrapper around the famous PHPMailer Mailer class and the text/template template system., (*1)
{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
| Parameter | Name | Default |
|---|---|---|
charset |
||
to |
||
from |
||
cc |
||
bcc |
||
With auto-failover to second SMTP-Server., (*2)
$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"]);
composer require phore/mail
$mailer = new PhoreMailer(); $mailer->phpmailer->phpMailerFunction();
$mailer = new PhoreMailer(); $mailer->textTemplate->textTemplateFunction();
This method is for testing only. Most Mailservers will reject mail transferred with this method., (*3)
Instead of sending the mail, you can retrieve the PHPMailer
instance by calling prepare()., (*4)
$phpmail = $phoreMailer->prepare($template,[]); print_r ($phpmail); $phpmail->Send();
$mailer->setSendMailFunction(function (PHPMailer $mail, PhoreMailer $phoreMailer) {
$res["to"] = $mail->getAllRecipientAddresses();
$res["subject"] = $mail->Subject;
$res["html"] = $mail->Body;
$res["text"] = $mail->AltBody;
});
MIT