p2p.wrox.com Forums

Need to download code?

View our list of code downloads.

  Return to Index  

proasp_codeclinic thread: Trying to send mail from ASP page.

Message #1 by "T.L. Jackson" <actionjackson@a...> on Wed, 6 Jun 2001 04:06:13
I was wondering if anybody can take a look at this code and tell me what is 
wrong with it.  Basically, it seems like it is working because I get my 
confirmation on my webpage that my password has been sent to me.  But I 
don't recieve anything.  My webhosting company uses ASPmail.  The following 
is my asp page code:


<!--#INCLUDE FILE="../board/config.asp" -->
<!--#INCLUDE FILE="../board/top.asp" -->


if Request.QueryString("mode") = "doit" then

	Dim objConn
	set objConn = Server.CreateObject("ADODB.Connection")
	objConn.Open "Provider=Microsoft.Jet.OLEDB.4.0; " & _

	dim Mailer
   Set Mailer = Server.CreateObject("SMTPsvg.Mailer")
	MailServer = "actionjackson.net:8383"
	Recipients = request.form("email")
	Sender = "actionjackson@a..."
	Subject = "Action 2000's Discussion Forum Password"
	mssg = "You have received this mail because you have asked to be 
reminded of you password"
	mssg = mssg & "For the Action 2000's Discussion Forum at 
http://www.actionjackson.net/board" & vbCrLf & vbCrLf
	strSql = "Select M_name, M_Password, M_Email from members where 
M_Name = '"
	strSql = strSql & Request.Form("Name") & "' and M_Email ='"
	strSql = strSql & Request.Form("email") & "'"
	set rs = objConn.Execute (StrSql)
	if rs.EOF or rs.BOF then
		mssg = mssg & "Sorry The details you passed were unknown." 
& vbCrLf & vbCrLf
		mssg = mssg & "Please register again at 
http://www.actionjackson.net/board/rules.asp" & vbCrLf
		mssg = mssg & " Your Password id :- " & rs("M_Password") & 
	End if
	mssg = mssg & "Thank you for using the Action 2000's Discussion 
	MailServer = MailServer
	Recipients = Recipients
	Sender = Sender
	Subject = Subject
	Message = mssg
	on error resume next '  Ignore Errors
	Set Mailer = Nothing
	on error resume next
	set rs=nothing
	set objConn = nothing

<p align=center><font face="<% =DefaultFontFace %>" size=4>Password 
<p align=center><font face="<% =DefaultFontFace %>" size=2>You should 
receive an email any moment now!</p>


<p align=center><font face="<% =DefaultFontFace %>" size=4>Password 
<form action="pword.asp?mode=doit" method="post">
<div align="center">
<TABLE background="" bgColor="gold" border=1 borderColor=#000000 
cellSpacing=0 width=70%>
<TD width=50%><FONT face="<% =DefaultFontFace %>" size=2>User Name </TD>
<TD width=50%><FONT face="<% =DefaultFontFace %>" size=3>
<INPUT name=Name size=30> </FONT></TD>
<TD><FONT face="<% =DefaultFontFace %>" size=2>Email</TD>
<TD><FONT face="<% =DefaultFontFace %>" size=3>
<INPUT name=email size=30 type=text value=""></FONT></TD>

<TD align=middle colSpan=2><INPUT name=submit1 type=submit 
<P> </P>

End if 



Thank you, T

  Return to Index