Using Variables for From Header (version 2/php 4)?
Posted: Thu Jan 18, 2007 4:41 pm
feyd | Please use
Thank you for your time. I will gladly donate to this project over time, I just have to figure out how to use it first 
feyd | Please use
Code: Select all
,Code: Select all
and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]
Hey,
For some reason, when I use the code I displayed last month in the personalization thread, the code worked if the firstname/email were hard coded.
How can I allow them to be variables? I want to be able to set it anytime I want from a config file
For instance, my code is below (as i'd like to use it to personalize without fail):Code: Select all
set_time_limit(0); ignore_user_abort();
flush(); ob_flush();
$sql="Select firstname,lastname,email,IP,joindate from pt_mailtemp";
$result=mysql_query($sql);
if (!$swift->hasFailed())
{
while($row=mysql_fetch_array($result))
{
$firstname=$row["firstname"];
$recipients=$row["email"];
$ip=$row["IP"];
$joindate=$row["joindate"];
$message=$_POST["message"];
$subject=$_POST["subject"];
$message=str_replace("[firstname]",$firstname,$message);
$subject=str_replace("[firstname]",$firstname,$subject);
$message=str_replace("[ip]",$ip,$message);
$message=str_replace("[joindate]",$joindate,$message);
$swift->send($recipients, '"John Smith<johnsmith@lblahblah.com>', $subject, $message);
}
$swift->close();feyd | Please use
Code: Select all
,Code: Select all
and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]