Page 1 of 1

Using Variables for From Header (version 2/php 4)?

Posted: Thu Jan 18, 2007 4:41 pm
by jbh
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();
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]

Posted: Fri Jan 19, 2007 7:17 am
by Chris Corbyn
This isn't possible in version 2 unfortunately. It's one of the issues that was addressed whilst building version 3... but the release of v3 is still delayed due to my ridiculously hectic/overstretched schedule right now :(

If you PM me I may be able to give you a patch to make it work in v2. Might not respond in the next few hours though.