[thelist] Html Email

Maximillian Schwanekamp lists at neptunewebworks.com
Fri Apr 8 19:02:09 CDT 2005


Darin Lang wrote:
> Great design links. Thank you. But it is not really the design part that 
> is giving me trouble, yet, I can't even SEND the mail. I am trying to 
> figure out how to send the email.

If you're using PHP, phpMailer does a great job of this.  It's 
especially easy when you use it with Smarty templates for the message 
body.  The phpMailer HTML Mail tutorial is quite easy to follow:
http://phpmailer.sourceforge.net/tutorial.html#4

I like to use Smarty (or another templating engine) with the HTML 
content before assigning it to the mailer object.  Something like this:

//do stuff with $smarty object instance of Smarty
$mailer =& new PHPMailer();
$mailer->Body    = $smarty->fetch('html_mail.tpl');
$mailer->AltBody = $smarty->fetch('text_mail.tpl');
$mailer->AddAddress($to_email, $to_name);
if(! $mailer->Send() )
{
	//error
} else {
	// msg sent!
}

HTH!

-- 
Maximillian Von Schwanekamp
http://www.neptunewebworks.com/



More information about the thelist mailing list