Email Verification for Newsletters, Mailing Lists in ASP.NET

It is very important to verify an email id when subscribing for newsletters, mailing lists, etc. If you don't verify email id, you could end up with many dead email ids. So the process of subscribing for newsletters, mailing lists should include email verification.

You can do it as following....
1] Verify email id using regular expressions.

2] Check whether that email id is already used to subscribe for newsletters/mailing list. If yes, you should handle it as per your preferences and needs.

3] Send an email to the email address. It should include a link to verify his/her account, for example verify.aspx?e=em&v=guid. The GUID generated and stored in the database for the user. If you get an error while sending email check for the "SmtpException", find the status codes for this exception here. If its related to wrong email address, show the error to user immediately.

4] If the email is sent successfully, insert a record in subscribers table with all details, like (Name, emailid, password, country, verified, etc). The "verified" field will indicate whether the user is verified, it will have GUID value initially that you have sent with verify link in the email.

5] When the user clicks the verify link, in your verify.aspx page, search the table in your database for a record with corresponding email id and verify code. If found replace the verify field value in the database with "Yes" to indicate that the account is verified, and add it to list of recipients.

You should also check regularly for dead email ids, if the delivery of newsletter fails for a particular email id for more than 2 times, you should consider deleting it from the recipients list.


0 comments:

Post a Comment