|
Posted by Messju Mohr on 04/07/05 01:41
On Thu, Apr 07, 2005 at 12:22:12AM +0200, lpenou wrote:
> Hi list,
>
> I'm looking for an example using a template to send an email, best
> will be an HTML + text email
> dis somenone already publish somewhere an example ?
i like the phpmailer for advanced mailing from php. see:
http://phpmailer.sourceforge.net/
with that you only nee $smarty->fetch() to get the rendered template
as a string and assign that as mail-body to phpmailer.
a simple example:
/* here initialize $smarty, assign vars etc. */
require("class.phpmailer.php");
$mail = new PHPMailer();
$mail->Body = $smarty->fetch('html_mail.tpl');
$mail->AltBody = $smarty->fetch('text_mail.tpl');
$mail->AddAddress($to_email, $to_full_name);
if(!$mail->Send()) {
echo "There has been a mail error sending to " . $row["email"] . "<br>";
} else {
// mail was successfully sent.
}
greetings
messju
[Back to original message]
|