Jump to content

Archived

This topic is now archived and is closed to further replies.

robcrozier

automated emails

Recommended Posts

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

Share this post


Link to post
Share on other sites
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]

Share this post


Link to post
Share on other sites

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.