Advertisement
Java_Volume1 Validation/ Processing #101360

Verifying Email Addresses the new way!

Today, two of the biggest assets a portal has are its users and the data about them. As the database grows, its important that the information being collected is accurate or else it would be worthless. While there are many things like the name, age or profession of a user which a site cannot verify without using a third-part solution, there is the e-mail address of users which can and must be verified. Today, more than 75% of portals verify e-mail addresses. Website do this in many diffrent ways. The methods range from sending activation code to links on the e-mail address and wait till the user, in one way or another, "responds" to the mail. In this article today, I will discuss one of the newly introduced methods which does not require the member to do anything except open the welcome letter when he/she signup. The technique used in this article has several advantages: No activation code for user to enter or URLs for user to click on in the e-mail message In someways, more secure than other solutions as the user does not find out anything about whats going on in the background when the welcome message loads.

AI

Riepilogo AI: This codebase represents a historical implementation of the logic described in the metadata. Our preservation engine analyzes the structure to provide context for modern developers.

Codice sorgente
original-source
<HTML>
<font size=2 face="Verdana,tahoma">
Today, two of the biggest assets a portal has are its users and the data about them. As the database grows, its important that the 
information being collected is accurate or else it would be worthless. While there are many things like the name, age or profession of a user 
which a site cannot verify without using a third-part solution, there is the e-mail address of users which can and must be verified. Today, 
more than 75% of portals verify e-mail addresses. Website do this in many diffrent ways. The methods range from sending activation code to 
links on the e-mail address and wait till the user, in one way or another, "responds" to the mail. In this article today, I will discuss one 
of the newly introduced methods which <B>does not</B> require the member to do anything except open the welcome letter when he/she 
signup.<BR><BR>
The technique used in this article has several advantages:<BR><BR>
<LI> No activation code for user to enter or URLs for user to click on in the e-mail message
<LI> In someways, more secure than other solutions as the user does not find out anything about whats going on in the background when the 
welcome message loads.
</LI><BR><BR>
I can hear you saying "whatever... lets move on"... well I cannot agree with you anymore!
<BR>
<BR>
<HR size=1 color=black>
<BR><B>
<font size=4 color="green" face="Verdana,tahoma">How Its Done
</font><BR>
</B>
<BR>
<font size="2" face="verdana,tahoma">
The way we verify the e-mail address of the user in this example is very interesting. When we send the user the welcome letter to their 
e-mail address they provided us with, we will imbed in that e-mail message an image. When we specify the image in our message, we will use 
an HTML <small><B><&nbsp;IMG></small> like shown below:</B>
<BR><BR>
	<TABLE WIDTH="100%" bgcolor="#EBEBEB" border="0">
	<TR>
	<TD>
	<CODE>
	<font size="2">
	<&nbsp;img src="http://www.bakery.biz/activate.asp?aCode=1234" >
	</TD>
	</TR>
	</table>
<BR>
When the user opens the welcome message, the request for the image will be sent to activate.asp <B> along</B> with the querystring data. When 
the request comes to activate.asp,it can then do the database processing and send the image. <BR><BR>
The following illustration may help you better understand the whole concept.<BR><BR><img 
src="http://www11.ewebcity.com/q2261/emailchecking/pic1.gif">
<BR><B>
<HR size=1 color="#EBEBEB"><BR>
<font size=4 color="green" face="Verdana,tahoma">Application Structure
</font><BR><BR>
</B><font size="2" face="Verdana,Tahoma">
This application will consist of four <B>total</B> files including the database. Following are their names along with a brief description.
<BR><BR>
<LI><B> RegisterForm.asp</B>- This will have the registration form used to signup.
<LI><B> Register_action.asp</B>- This file will contain insert the data passed from RegisterForm.asp into the database(DB.mdb).
<LI><B> Activate.asp</B>- Activate.asp will do the dirty work of activating the user's account when the user opens the welcome letter.
<LI><B> DB.mdb</B>- This will hold the registration information of users.
<BR><BR>
<font size=4 color="green" face="Verdana"><B>
DB.MDB</B><BR><BR></font>
<font size="2" face="Verdana" color="black">
DB.MDB is going to be where the registration data will be stored. The database itself contains 6 fields(as shown below).
<BR>
<BR>
<img src="http://www11.ewebcity.com/q2261/emailchecking/pic3.gif"><BR><BR>
You can see the <CODE><font size="2">IsEmailVerified</font></CODE> field above. That is how we will keep track of whether the registrar's 
account has been activated or not(with yes being activated and no being not activated).
</font>
<BR><BR>
<font size=4 color="green" face="Verdana"><B>
RegisterForm.asp</B><BR><BR></font>
<font size="2" face="Verdana" color="black">
We can quickly go through RegisterForm.asp as it is nothing more than the file which contains the HTML form for signup. I wont go through the 
whole HTML code as its pretty self-explanatory. But, to give you the idea, below is the screenshot of <CODE><font 
size="2">RegisterForm.asp</font></CODE>.<BR><BR>
<img src="http://www11.ewebcity.com/q2261/emailchecking/pic2.gif">
<BR><BR>
<font size=4 color="green" face="Verdana"><B>
Register_action.asp</B><BR><BR></font>
<font size="2" face="Verdana" color="black">
<code><font size="2">Register_action.asp</font></code> contains the ASP code which adds the user's input from <code><font 
size="2">Register_Form.asp</font></code> into the databse. This file also contains the code which sends the welcome letter to the user on the 
email address the user provides. Below is the complete source code of this file. <B><BR><BR>NOTE:</B>This application uses ASP email to send 
the welcome mail. If you have some other component, you will have to make the respected changes into Register_action.asp.
<BR><BR>
<table width="100%" border=0 bgcolor="#EBEBEB">
<TR>
<TD>
<FONT FACE="Arial" SIZE="2" COLOR="#008000"><FONT COLOR="#800000"><FONT COLOR="#FF0000">&lt;%</FONT><BR>
&nbsp;&nbsp;&nbsp;&nbsp;<FONT COLOR="#008000">'Connection string</FONT><BR>
&nbsp;&nbsp;&nbsp;&nbsp;strConnect=<FONT COLOR="#008080">&quot;Provider=Microsoft.Jet.OLEDB.4.0;Data Source=&quot;</FONT><FONT 
COLOR="#000000"><B>&</B></FONT> <FONT COLOR="#800080"><B>Server</B></FONT>.<FONT COLOR="#800080"><B>MapPath</B></FONT>(<FONT 
COLOR="#008080">&quot;DB.mdb&quot;</FONT>)<FONT COLOR="#000000"><B>&</B></FONT><FONT COLOR="#008080">&quot;;&quot;</FONT><BR>
&nbsp;&nbsp;&nbsp;&nbsp;<BR>
&nbsp;&nbsp;&nbsp;&nbsp;<FONT COLOR="#008000">'Define the variable</FONT><BR>
&nbsp;&nbsp;&nbsp;&nbsp;<FONT COLOR="#0000FF">Dim</FONT> objSignup<BR>
&nbsp;&nbsp;&nbsp;&nbsp;<BR>
&nbsp;&nbsp;&nbsp;&nbsp;<FONT COLOR="#008000">'Create a Recordset object</FONT><BR>
&nbsp;&nbsp;&nbsp;&nbsp;<FONT COLOR="#0000FF">Set</FONT> objSignup <FONT COLOR="#000000"><B>=</B></FONT> <FONT 
COLOR="#800080"><B>Server</B></FONT>.<FONT COLOR="#800080"><B>CreateObject</B></FONT>(<FONT 
COLOR="#008080">&quot;Adodb.Recordset&quot;</FONT>) <BR>
&nbsp;&nbsp;&nbsp;&nbsp;<BR>
&nbsp;&nbsp;&nbsp;&nbsp;<FONT COLOR="#008000">'Open tbl_Users</FONT><BR>
&nbsp;&nbsp;&nbsp;&nbsp;objSignup.Open <FONT COLOR="#008080">&quot;SELECT * FROM tbl_Users&quot;</FONT>,strConnect,<FONT 
COLOR="#008000">3</FONT>, <FONT COLOR="#008000">3</FONT> <FONT COLOR="#008000">'3=adOpenStatic,adLockOptimistic</FONT><BR>
&nbsp;&nbsp;&nbsp;&nbsp;<BR>
&nbsp;&nbsp;&nbsp;&nbsp;<FONT COLOR="#008000">'Add a new entry into tbl_Users</FONT><BR>
&nbsp;&nbsp;&nbsp;&nbsp;objSignup.AddNew <BR>
&nbsp;&nbsp;&nbsp;&nbsp;objSignup(<FONT COLOR="#008080">&quot;Username&quot;</FONT>)<FONT COLOR="#000000"><B>=</B></FONT><FONT 
COLOR="#800080"><B>Request</B></FONT>.<FONT COLOR="#800080"><B>Form</B></FONT>(<FONT COLOR="#008080">&quot;Username&quot;</FONT>)<BR>
&nbsp;&nbsp;&nbsp;&nbsp;objSignup(<FONT COLOR="#008080">&quot;Password&quot;</FONT>)<FONT COLOR="#000000"><B>=</B></FONT><FONT 
COLOR="#800080"><B>Request</B></FONT>.<FONT COLOR="#800080"><B>Form</B></FONT>(<FONT COLOR="#008080">&quot;Password&quot;</FONT>)<BR>
&nbsp;&nbsp;&nbsp;&nbsp;objSignup(<FONT COLOR="#008080">&quot;Name&quot;</FONT>)<FONT COLOR="#000000"><B>=</B></FONT><FONT 
COLOR="#800080"><B>Request</B></FONT>.<FONT COLOR="#800080"><B>Form</B></FONT>(<FONT COLOR="#008080">&quot;Name&quot;</FONT>)<BR>
&nbsp;&nbsp;&nbsp;&nbsp;objSignup(<FONT COLOR="#008080">&quot;Email&quot;</FONT>)<FONT COLOR="#000000"><B>=</B></FONT><FONT 
COLOR="#800080"><B>Request</B></FONT>.<FONT COLOR="#800080"><B>Form</B></FONT>(<FONT COLOR="#008080">&quot;Email&quot;</FONT>)<BR>
&nbsp;&nbsp;&nbsp;&nbsp;<BR>
&nbsp;&nbsp;&nbsp;&nbsp;<FONT COLOR="#008000">'Save the record and close objSignup(the recordset)</FONT><BR>
&nbsp;&nbsp;&nbsp;&nbsp;objSignup.Update <BR>
&nbsp;&nbsp;&nbsp;&nbsp;<BR>
&nbsp;&nbsp;&nbsp;&nbsp;<FONT COLOR="#008000">'We will make the userID our activation code. </FONT><BR>
&nbsp;&nbsp;&nbsp;&nbsp;<FONT COLOR="#008000">'We have to save the activation code into a variable so that we can access it later</FONT><BR>
&nbsp;&nbsp;&nbsp;&nbsp;<BR>
&nbsp;&nbsp;&nbsp;&nbsp;activationCode <FONT COLOR="#000000"><B>=</B></FONT> objSignup(<FONT COLOR="#008080">&quot;UserID&quot;</FONT>)<BR>
&nbsp;&nbsp;&nbsp;&nbsp;objSignup.<FONT COLOR="#800080"><B>Close</B></FONT> <BR>
&nbsp;&nbsp;&nbsp;&nbsp;<FONT COLOR="#008000">'Remove objSignup from the memory</FONT><BR>
&nbsp;&nbsp;&nbsp;&nbsp;<FONT COLOR="#0000FF">Set</FONT> objSignup <FONT COLOR="#000000"><B>=</B></FONT> <FONT 
COLOR="#0000FF">Nothing</FONT><BR>
&nbsp;&nbsp;&nbsp;&nbsp;<BR>
&nbsp;&nbsp;&nbsp;&nbsp;<FONT COLOR="#008000">'Now lets send the welcome mail to the user</FONT><BR>
&nbsp;&nbsp;&nbsp;&nbsp;strMailContent=<FONT COLOR="#008080">&quot;&lt;HTML<FONT COLOR="#000000"><B>&gt;</B></FONT>&lt;BODY<FONT 
COLOR="#000000"><B>&gt;</B></FONT>&quot;</FONT><BR>
&nbsp;&nbsp;&nbsp;&nbsp;strMailContent=strMailContent <FONT COLOR="#000000"><B>&</B></FONT> <FONT COLOR="#008080">&quot;&lt;img 
src='http://127.0.0.1/EmailChecking/activate.asp?ActivationCode=&quot;</FONT> <FONT COLOR="#000000"><B>&</B></FONT> activationCode <FONT 
COLOR="#000000"><B>&</B></FONT> <FONT COLOR="#008080">&quot;'<FONT COLOR="#000000"><B>&gt;</B></FONT>&quot;</FONT><BR>
&nbsp;&nbsp;&nbsp;&nbsp;strMailContent=strMailContent <FONT COLOR="#000000"><B>&</B></FONT> <FONT COLOR="#008080">&quot;&lt;BR<FONT 
COLOR="#000000"><B>&gt;</B></FONT>&lt;BR<FONT COLOR="#000000"><B>&gt;</B></FONT>&lt;font size=2 face='Verdana'<FONT 
COLOR="#000000"><B>&gt;</B></FONT>Hello!&lt;BR<FONT COLOR="#000000"><B>&gt;</B></FONT>&lt;BR<FONT 
COLOR="#000000"><B>&gt;</B></FONT>&quot;</FONT><BR>
&nbsp;&nbsp;&nbsp;&nbsp;strMailContent=strMailContent <FONT COLOR="#000000"><B>&</B></FONT> <FONT COLOR="#008080">&quot;You have successfully 
become a member of bakery.biz! You can now enjoy many benefits. Just logon to bakery.biz and let the fun begin.&quot;</FONT><BR>
&nbsp;&nbsp;&nbsp;&nbsp;strMailContent=strMailContent <FONT COLOR="#000000"><B>&</B></FONT> <FONT COLOR="#008080">&quot;&lt;BR<FONT 
COLOR="#000000"><B>&gt;</B></FONT>&lt;BR<FONT COLOR="#000000"><B>&gt;</B></FONT>Thanks,&lt;BR<FONT 
COLOR="#000000"><B>&gt;</B></FONT>&lt;BR<FONT COLOR="#000000"><B>&gt;</B></FONT>The Bakery.Biz Team&lt;/HTML<FONT 
COLOR="#000000"><B>&gt;</B></FONT>&lt;/BODY<FONT COLOR="#000000"><B>&gt;</B></FONT>&quot;</FONT><BR>
 <BR>
&nbsp;&nbsp;&nbsp;&nbsp;SendMail <FONT COLOR="#008080">&quot;Zaid&quot;</FONT>,<FONT 
COLOR="#008080">&quot;zaid@designMD.com&quot;</FONT>,strMailContent,<FONT COLOR="#800080"><B>Request</B></FONT>.<FONT 
COLOR="#800080"><B>Form</B></FONT>(<FONT COLOR="#008080">&quot;email&quot;</FONT>),<FONT COLOR="#008080">&quot;Welcome to 
bakery.biz!&quot;</FONT><BR>
&nbsp;&nbsp;&nbsp;&nbsp;<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<FONT COLOR="#0000FF">Function</FONT> SendMail 
(FromName,FromEmail,MailContent,MailingAddress,Subject)<BR>
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<FONT COLOR="#0000FF">Set</FONT> Mail <FONT 
COLOR="#000000"><B>=</B></FONT> <FONT COLOR="#800080"><B>Server</B></FONT>.<FONT COLOR="#800080"><B>CreateObject</B></FONT>(<FONT 
COLOR="#008080">&quot;Persits.MailSender&quot;</FONT>)<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Mail.Host <FONT COLOR="#000000"><B>=</B></FONT> <FONT 
COLOR="#008080">&quot;smtp.amexol.net&quot;</FONT> <FONT COLOR="#008000">' Specify a valid SMTP server</FONT><BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Mail.From <FONT COLOR="#000000"><B>=</B></FONT> FromEmail <FONT 
COLOR="#008000">' Specify sender<FONT COLOR="#008000">'s address</FONT><BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Mail.FromName <FONT COLOR="#000000"><B>=</B></FONT> FromName <FONT 
COLOR="#008000">' Specify sender<FONT COLOR="#008000">'s name</FONT><BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Mail.AddBcc MailingAddress<BR>
 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Mail.Subject <FONT COLOR="#000000"><B>=</B></FONT> subject<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Mail.Body <FONT COLOR="#000000"><B>=</B></FONT> MailContent<BR>
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<FONT COLOR="#008000">'On Error Resume Next</FONT><BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<FONT COLOR="#008000">'Mail.Send</FONT><BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<FONT COLOR="#008000">'If Err &lt;&gt; 0 Then</FONT><BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<FONT COLOR="#008000">'  Response.Write &quot;Error encountered: 
&quot; &amp; Err.Description</FONT><BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<FONT COLOR="#008000">'End If</FONT><BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;mail.IsHTML <FONT COLOR="#000000"><B>=</B></FONT> <FONT 
COLOR="#0000FF">True</FONT><BR>
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;mail.Send <BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<FONT COLOR="#0000FF">&nbsp;End</FONT> <FONT 
COLOR="#0000FF">Function</FONT><BR>
<BR>
<FONT COLOR="#FF0000">%&gt;</FONT></FONT> <BR>
&lt;font face=&quot;Verdana&quot; size=&quot;2&quot;&gt;<BR>
Congratulations! You have successfully signed-up! A welcome mail has been sent to the e-mail address you provided. In order to successfully 
activate you account, you &lt;b&gt;must&lt;/b&gt; read the welcome mail we sent. Thank you.<BR>
 </FONT>

</TR>
</TD>
</table>
 
<font size="2" face="Verdana,tahoma"><BR><BR>
The code above is self-explanatory for most of the part. However, there are some key pieces of code that cannot be ignored. <BR><BR>
The code starts out by initiating a recordset object called <code><font size="2">objSignup</font></code>. We use this object to write the 
user's info in the database. Note that before we close this object, we save the user's userid into a variable called <code><font 
size="2">activationCode</font></code>. You will see why we do this in the next paragraph. <BR><BR>Once the user's userinfo is saved into the 
database, we have to send the confirmation/welcome e-mail. The content of the email to be sent is stored in the <code><font 
size="2">strMailContent</font></Code> variable. The most important part of the e-mail is the <code><font size="2"><B>< img 
src</B></font></code> tag part of the mail shown below: (Notice that here is where we make use of the activationCode variable we saved 
earlier in the file.)
<BR><BR><small>
<B>NOTE</B>For those of you who have read my previous article titled "<a 
href="http://www.planet-source-code.com/xq/ASP/txtCodeId.6566/lngWId.4/qx/vb/scripts/ShowCode.htm" target="_blank">Sending emails from asp by 
reading them from text files</a>", you might be wondering why I chose to embed the mail directly into the ASP file rather than use the 
technique I described in my last submission. Well to answer your question, I did that to keep things simple as people who have not read my 
previous article can get confused for something not required.<BR><BR></small>
<table width="100%" border="0" bgcolor="#EBEBEB">
<TR>
<TD><code>
strMailContent=strMailContent & "&lt;img src='http://127.0.0.1/EmailChecking/activate.asp?ActivationCode=" & activationCode & "'&gt;"</code>
</TD>
</TR>
</table>
<BR>
If you are not familiar, you will probably freak out after looking at the src attribute of the img tag above. But this is the most exciting 
part of all. When the e-mail message is sent and is retreived by the user, the mail server goes to this ASP page to retreive the image. As 
you may/may not know, ASP pages can be made to output JPG/GIF files to the client. And this is what we will discuss next!
<HR size=1 color="#EBEBEB"><BR><B>
<font size=4 color="green" face="Verdana,tahoma">Activate.asp
</font><BR><BR></B>This is the file which the browser will go to in order to retreive the image in the email. Take a look at the source code.
<BR><BR>
<table width="100%" border="0" bgcolor="#EBEBEB">
<TR>
<TD>
&lt;%
 Response.ContentType = "image/gif"<BR><!--METADATA TYPE="typelib"
   <BR>UUID="00000205-0000-0010-8000-00AA006D2EA4"
   <BR>NAME="ADODB Type Library"
<font color="green"><BR><BR>
'Connection string</font><BR>
	strConnect="Provider=Microsoft.Jet.OLEDB.4.0;Data Source="& Server.MapPath("DB.mdb")&";"
	<BR><BR>
	<font color="green">'SQL Query which activates the account in the database (sets IsEmailVerified field to True</font><BR>
	SQL = "UPDATE tbl_Users SET tbl_Users.IsEmailVerified = True WHERE tbl_Users.UserID=" & Request.QueryString("ActivationCode")<BR><BR>
<font color="green">
	'Define the variable</font><BR>
	Dim objActivate
	<BR><BR><font color="green">
'Create a Recordset object</font><BR>
	Set objActivate = Server.CreateObject("Adodb.Recordset") <BR>
	objActivate.Open SQL,strConnect
<BR>
SendPicture
<BR><BR>
Function SendPicture
<BR><BR>
 'Create a stream object<BR>
 Dim objGetFile<BR>
 Set objGetFile = Server.CreateObject("ADODB.Stream")
 
<BR><BR>
 'Open a GIF file
 objGetFile.Type = adTypeBinary<BR>
 objGetFile.Open<BR>
 objGetFile.LoadFromFile "c:/inetpub/wwwroot/EmailChecking/welcome.gif"<BR>
 
 'Output the contents of the stream object<BR>
 Response.BinaryWrite objGetFile.Read<BR><BR>
 
 'Clean up....<BR>
 objGetFile.Close<BR>
 Set objGetFile = Nothing<BR>
<BR> End Function
%>
</TD></TR></table>
<BR><BR>
This is the most important part of the application. This code starts out by telling the browser that the output will be sent in GIF form. 
Next, we have to load the ADODB constants. <BR><BR>
After defining the output type and loading the constants, we are ready to activate the user's account into the database. We do this by 
running an update SQL query as shown below. The query requests the activationCode and sets the IsEmailVerified field to true into the db.
<BR><BR>
<table width="100%" bgcolor="#EBEBEB">
<TR>
<TD>
<BR>
<code>
<font size=2>
'Connection string<BR>
strConnect="Provider=Microsoft.Jet.OLEDB.4.0;Data Source="& Server.MapPath("DB.mdb")&";" 
<BR><BR>
'SQL Query which activates the account in the database (sets IsEmailVerified field to True<BR>
SQL = "UPDATE tbl_Users SET tbl_Users.IsEmailVerified = True WHERE tbl_Users.UserID=" & Request.QueryString("ActivationCode")<BR><BR>
'Define the variable<BR>
Dim objActivate <BR><BR>
'Create a Recordset object<BR>
Set objActivate = Server.CreateObject("Adodb.Recordset")<BR> 
objActivate.Open SQL,strConnect <BR>
</code></Td>
</TR>
</table><BR><BR>Once we have updated the account into the database, we still have to send the output. To keep things clear, I seperated the 
updating part of the code and the output part of the code by creating a function called SendPicture. SendPicture function sends a picture 
called welcome.gif back to the browser. And thats it... enjoy and dont forget to vote!<BR><BR>Dont forget to contact me at zaid@designMD.com 
or leave comments below if you have any questions about this or any other submission of mine.<BR><BR>
<font size=4 color="green" face="Verdana"><B>
Setting Up The Application</B><BR><BR></font>
This sample can be setup by following the direction below:<BR>
<BR>
<B>1.</B> Download and unzip the file.<BR>
<B>2.</B> Move the folder named EmailChecking into wwwroot.<BR>
<B>3.</B> Run http://127.0.0.1/EmailChecking/registerform.asp
<BR><BR>
<font size=4 color="green" face="Verdana"><B>
Other Submissions of mine!</B><BR><BR></font><LI><a 
href="http://www.planet-source-code.com/xq/ASP/txtCodeId.6566/lngWId.4/qx/vb/scripts/ShowCode.htm">Sending emails from asp by reading them 
from text files 
</a><BR><LI>
<a href="http://www.planet-source-code.com/xq/ASP/txtCodeId.6568/lngWId.4/qx/vb/scripts/ShowCode.htm">Trim HTML from an ASP String 
(exceptions to certain HTML tags can be made) </a>
Commenti originali (3)
Recuperato da Wayback Machine