Home > Articles > Programming

  • Print
  • + Share This

Opt-In, Opt-Out

So now we have a working application that allows a user to opt-in, but what happens if a user wants to opt-out, or perhaps just to change between HTML and text-based email?

All unsolicited email must include a way for the user to remove himself or herself from the list. To the bottom of all messages, we can add a line that takes the user to a page which will allow him or her to unsubscribe or change his subscription. We also will feed this page the user's email address, in order to save the trouble of asking for it later. The line we add to the message body is simple:

Mail.Body = Mail.Body & _
"To change your subscription or to unsubscribe, " & _
"please visit http://www.nicholaschase.com/changesub.asp?email="&server.URLEncode(userSet("email"))

(Note that since this line will become a URL, we need to make sure that any unusual characters that might appear are encoded.)

The changesub.asp (view Listing 6) page is simple; it must simply give the user a place to indicate what he wants to do, and enter a password with which to do it. This form enables users to choose what to do with their account, and when users submit it, the form takes them to Listing 7. There's nothing particularly complicated about this page, although we do have a few nested if-then statements. When we check to make sure that the email address and password are valid, we simply delete a user who wishes to be removed, or we update a changed mailtype.

  • + Share This
  • 🔖 Save To Your Account

Related Resources

There are currently no related titles. Please check back later.