ge*****************@alphaworks.co.uk (Geoff Soper) wrote in message news:<8e**************************@posting.google. com>...
I'm looking at sending e-mails from PHP based on templates with
expansion of variables, similar to a mail merge. Does anyone know of
existing code for this or can point me in the right direction. I
assume I will need to use regexps but am not yet sure exactly how.
Any advice gratefully recieved,
My taste...
$from_email = 'fetched from DB or so';
$to_email = 'fetched from DB or so';
$name = 'fetched from DB or so';
//send via mail template...
include('./includes/mailtemplates/send_welcome_msg.inc.php');
<?php
//send_welcome_msg.inc.php
//mail template file.... May use some other codes to edit this
template file
$subject = 'xxxxxxx';
$message = <<<EOT
Hiiii $name,
xxxxx
Webmaster
EOT;
//send email...
mail($to_email, $subject, $message,
"From: Webmaster <$from_email>\r\n" .
"Reply-To: $from_email\r\n" .
"X-Mailer: PHP/" . phpversion()
);
?>
--
"I don't believe in the God who doesn't give me food, but shows me
heaven!" -- Swami Vivekanandha
Email: rrjanbiah-at-Y!com