Re: [SMARTY] lookin for an example using Smarty template fore sending mail

From: Date: Wed, 06 Apr 2005 22:41:50 +0000
Subject: Re: [SMARTY] lookin for an example using Smarty template fore sending mail
References: 1  Groups: php.smarty.general 
Request: Send a blank email to php-smarty-general+get-12424@lists.php.net to get a copy of this message
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

« previous php.smarty.general (#12424) next »