robcrozier Posted October 1, 2006 Share Posted October 1, 2006 hi everyone,Here’s the problem im trying to solve. I want to allow users to register their email addresses on a site in order to receive a monthly newsletter. However to avoid spam I want to initially send an automated email to the address they registered with which will include a link which they can click on to verify that it was actually them. When the link is clicked in the email I then want that persons email address to be stored in the database.Can anyone give me a clue?Cheers Quote Link to comment https://forums.phpfreaks.com/topic/22668-automated-emails/ Share on other sites More sharing options...
Daniel0 Posted October 1, 2006 Share Posted October 1, 2006 In the table containing the emails, have a field called is_activated with this type: ENUM('0','1')and a field called activation code with something like this type: VARCHAR(50)When they add their email and you add it to the database set is_activated to 0 and make a random activation code like [code]uniqid(md5($email.microtime());[code] Then send them a mail containg a link like this: http://example.com/activate.php?activation_code=**the activation code here**&email=**the email here**on the activate page you should check if the email matches the activation code, and if it does, then set is_activated to 1.When sending mails, only send it to email where is_activated is set to 1.[/code][/code] Quote Link to comment https://forums.phpfreaks.com/topic/22668-automated-emails/#findComment-101923 Share on other sites More sharing options...
robcrozier Posted October 1, 2006 Author Share Posted October 1, 2006 Thats spot on mate, exactly what i wanted.Thanks a lot!!! ;D Quote Link to comment https://forums.phpfreaks.com/topic/22668-automated-emails/#findComment-101929 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.