How to allow users to unsubscribe?
I set cron job to run php file that send latest update to my subscribers daily.
The question is, how do I add an extra link in the emails which allow my subscribers to stop receiving this daily update?
i would set another feild in your database in this case we will say "subscribed" with a default of "yes".
the link could point them to a page where they enter in their username and email or something, then using that info change the yes to no, and whe you pull the email address to send the daily email
makes sence to me, do you follow?
"SELECT email FROM users WHERE subscribed = yes";
If each email is sent separately to each subscriber, then the link can be created dynamically for each email and would include a value in the URL which would specify the specific user, something like http://www.yoursite.com/unsubscribe.php?id=1234567. Then if the user clicks the unsusbscribe link, the script called by that link would grab that identifier from the GET data to be used in the unsubscribe action (likely a query that toggles a "subscribe" flag in the user database. For better security, you might generate a second string to include in the URL, maybe a md5() of the user name or something, and add that as a second URL value to be checked when the users clicks the link. That could help prevent malicious users from requesting the unsubscribe link with random id values.
Users Browsing this Thread
There are currently 1 users browsing this thread. (0 members and 1 guests)