How To Dynamically Add Unsubscribe Link?
Posted: Sat Sep 06, 2008 12:24 am
Hey,
Forgive me but I could not find it in the wiki docs and only found one potential solution in the search function.
What is the surest way to get an unsubscribe link to work in this? Below is the code that I use, without fail, to send a message to each person in my database. I just want to append an unsubscribe link successfully.
Forgive me but I could not find it in the wiki docs and only found one potential solution in the search function.
What is the surest way to get an unsubscribe link to work in this? Below is the code that I use, without fail, to send a message to each person in my database. I just want to append an unsubscribe link successfully.
Code: Select all
# Connect stuff
$title=$_POST["title"];
$table=$_POST["table"];
$emailmessage=$_POST["message"];
$subject=$_POST["subject"];
$emailmessage = wordwrap($emailmessage, 64, "\n");
$emailmessage=stripslashes($emailmessage);
$message =& new Swift_Message($subject, $emailmessage);
$myemail="support@techiehowto.com";
# DB Stuff is in config file
include("config.php");
$sql="
SELECT paypalemail from $table where title='$title'
";
$result = @MYSQL_QUERY($sql);
while ($row = mysql_fetch_assoc($result))
{
$email=$row["paypalemail"];
$email=trim($email);
$emailmessage=str_replace("[email]",$email,$emailmessage);
$message->setSubject($subject);
$emailmessage=str_replace("[email]",$email,$emailmessage);
// THIS IS where I want to have something like
// $emailmessage.="http://www.mysite.com/unsubscribe.php?email=$email";
$swift->send($message, $email, $myemail);
}