Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Automatic unsubscribe from a mailinglist

Status
Not open for further replies.

acj123

Programmer
Dec 9, 2004
2
NO
Don't know if this is php spesific, but I have a php portal (running on linux) with a list of members. These members may daily receive updates by email. The body of this email contains a link to the site where the member can log in and unsubscribe from the mailinglist.

But, does someone know ways that a member can automaticlly unsubscribe from the list? I would like members to click on a link in an email and then they're simply unsubscribed.
Maybe the link send an automatic email. Does the mailserver need to be configured in a special way.

Thank's for any suggestions ;)
 
well, just make a php script:
unsub.php

then your mails get sent as usually, but at the bottom, you add:

If you wish to <a href=" title="unsubscribe from mailing list">Unsubscribe</a>

then you run a query:
UPDATE `users` SET... `mailing_list` = 0 WHERE `uid` = '{$id}' LIMIT 0,1;

ps. it is VERY vital that you make some kind of system that needs a login, so they cant simply put someones else membernumber in a web-browser and in that way remove them too, from the mailinglist.

eg:
1: mail to user, with unsub link
2: let user log in
3: ask for confirmation
4: update user
5: mail user confirmation email, that user has been removed from list.

DO NOT SKIP STEP 2!! Or the abuse will rain on your database.

Also remember to LIMIT the query! (even if you use ID, it is good habbit)

you might also want to run some sequrity checks on the uid variable, lime strip_tags(), etc. addslashes??

after you have made it, try to abuse the script, try to enter wrong information. A vital part of development, is stresstesting.

Olav Alexander Mjelde
Admin & Webmaster
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top