s01ipsist wrote:Just for the interest of those who are now using phplist-2.10.1
The following 2 changes to sendemaillib.php will make the phplist evaluate variables in the Subject line.
1
change line
- Code: Select all
if (!$mail->send("", $destinationemail, $fromname, $fromemail, $subject)) {
to
- Code: Select all
$theSubject = plugAttributes($subject, $email);
if (!$mail->send("", $destinationemail, $fromname, $fromemail, $theSubject)) {
2
above the line
- Code: Select all
function addAttachments($msgid,&$mail,$type) {
add following function
- Code: Select all
//srs added this function, clipped from the PHPlist user forum
//replace template vars in the subject line for customization based on user attributes
function plugAttributes($str="", $email="")
{
$custom_list=getUserAttributeValues($email);
while (list($AttribName,$AttribValue) = each ($custom_list)) {
foreach($custom_list AS $AttribName => $AttribValue)
$str = trim(str_replace("[{$AttribName}]",$AttribValue,$str));
}
return $str;
}
Just in case someone else was looking for the answer to this question with the latest version of PHPList (2.10.4), this modification works perfectly.
I searched for this solution and tried many variations before I found this simple solution from s01ipsist. Thanks for helping out!
I'm sure someone will need this, so I figured I would try to save you from searching every post in this forum. Just use this one if you have 2.10.4. It works!
I really don't understand why this hasn't been added as a standard in PHPList since it's such an easy, needed modification. Just my two sense.
Oh, by the way, the only reason why I didn't just link to it is because I didn't want to pose any unnecessary confusion, because the topic I found this on had a lot of clutter.
But for those of you who just "Have To Know", here is a link to the topic this quote originated from:
(This is because I haven't posted 10 times yet) {h}{t}{t}{p}{:}{/}{/}forums.phplist.{c}{o}{m}/viewtopic.php?t=2259&highlight=placeholder+subject
I hope this helps someone. I know it helped me! Thanks again s01ipsist!
Spanglishton