0

How to include An UNSUBSCRIBE link in newsletter sent to multiple users using PHPMailer? Like mydomain/unsubscribe.php?email=useremail.

please help. Thanks in advance.

mrafi5
  • 35
  • 8

1 Answers1

0

Just add it to the content of the message.

$mail->Body = "content<br><br>mydomain/unsubscribe.php?email=useremail";

or do you need the unsubscribe function?

InsaneSVK
  • 206
  • 2
  • 3
  • 10
  • But How to identify each user? like mydomain/unsubscribe.php?email=user1 mydomain/unsubscribe.php?email=user2 etc.... – mrafi5 May 31 '13 at 09:20
  • I need unsubscribe function. – mrafi5 May 31 '13 at 09:22
  • In the newsletter php mailer function, do you have some sort of MYSQL select? So you identify the emails, split them and send it to each user individually? Could you edit your question and post all the code from the newsletter function you already have? Thanks – InsaneSVK May 31 '13 at 09:26
  • $q="select email from subscribe where status=1"; $result=mysql_query($q) or die("nothing found"); if(mysql_num_rows($result)==0){die("nothing found"); } while($row=mysql_fetch_array($result)) { $email_list[]=$row['email']; } $to = implode(",", $email_list); $to_mail = explode(",", $to); foreach($to_mail as $email_ids) { $mail= new PHPMailer(); $body = file_get_contents($url_news_letter.'30may2013.php'); //some headers //mail->send();} – mrafi5 May 31 '13 at 09:35
  • put this with body part $body.="".$email_ids.""; – mrafi5 May 31 '13 at 09:48
  • Yea its working. I have used this before for reg confirmation. Thanks – mrafi5 May 31 '13 at 13:32