At 4:55 PM +0200 6/29/09, Grega Leskovsek wrote:
how is the best way to check if email address is valid: is this preg_match() OK?

How can I make double opt-in mail system? My idea:
1.) I remember the email entered and user data and the sha1($email);
in mysql db
2.) I send email with activation link of the sha1($email);
3.) I am not clear how to proceed when the link is activated. How to
update the db and submit the necessary form to the marketing.

Thanks in advance,

Double opt-in.

1. Have the user enter their email address via a form that let's them know they are subscribing to a service. You might want to check for a valid email address (many versions) and/or a CAPTCHA. additionally, you need to check if they have already registered OR in the process of registering.

2. After they submit their email address, then have your script create a unique token and record it coupled with the email address in your database.

3. Then send a confirmation email to that email address with the token appended as a link in the email -- with instructions for the receiver to either ignore the email (with apologies) or click the link and be taken back to your site where your script takes the confirmation token and checks your database for a token/email match. If there is one, then that completes the process and you have a confirmed double opt-in email address to use. If not, have them try again.

Here's the script I wrote to do that:




PHP General Mailing List (
To unsubscribe, visit:

Reply via email to