If you want to set up an online newsletter subscription form, you need to do several things to handle the name securely and properly.
First, you want to use a regular HTML form to get the user's email address. Make sure the spot in the form where the user types in their email address is well labelled, and that it is big enough for them to see the letters as they are typing them. Probably 90% of all typos happen because the user doesn't see that they mistyped a letter to fix it.
Next, the form goes to an ASP processing page. You assign the incomign email address to a variable, say EmailAdd. Now you must check for simple errors. I have advice on Error Checking an Email Address to make sure you take care of basic problems. If you see a problem, be sure to send the user to an error page so they can try again.
Once you are sure the email address looks at least reasonably OK, it's time to write that email address into the database. I highly recommend Getting the User's IP Address and storing that as well as the date/time of subscription in your database. That way, if a malicious person is signing up people in your system, you can turn the date/time of the offence and the IP address of the user over to the police. It's always better to be prepared.
First, use a select command to see if this user is already subscribed. No need to subscribe them again if they're already in there! If they are not a current user, use a simple Database Insert Command to add the new record to your database.
Once you are done, it's always wise to Send Them a Mail Message with a thank you. Also, show a thank you page that TELLS them they were just sent a thank you message. That way if they don't get the message from you, they can check their anti-spam filters and make sure they let your mail through. That way when you do actually try to send them a newsletter, hopefully they will already be set up to be able to read it!
Sending Out an ASP Newsletter Mailing
|Introduction to ASP Ebook|
Download this ebook to get everything you need to know about learning ASP - from a step by step tutorial to function lists, sample code, common errors and solutions, and much more! 101 pages.