You are here: Re: [SMARTY] lookin for an example using Smarty template fore sending mail « Smarty Templates Posts « IT news, forums, messages
Re: [SMARTY] lookin for an example using Smarty template fore sending mail

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

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация