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; " & _
					"Data 
Source=D:\inetpub\actionjackson\fpdb\board.mdb"


	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
	Else
		mssg = mssg & " Your Password id :- " & rs("M_Password") & 
vbCrLf
	End if
	
	mssg = mssg & "Thank you for using the Action 2000's Discussion 
Forum"
	
	
	MailServer = MailServer
	Recipients = Recipients
	Sender = Sender
	Subject = Subject
	Message = mssg
	on error resume next '  Ignore Errors
	SendMail
	Set Mailer = Nothing
	on error resume next
	rs.close
	set rs=nothing
	objConn.Close
	set objConn = nothing
%>

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

<%	
Else
%>

<p align=center><font face="<% =DefaultFontFace %>" size=4>Password 
Reminder</p>
<form action="pword.asp?mode=doit" method="post">
<div align="center">
<TABLE background="" bgColor="gold" border=1 borderColor=#000000 
cellPadding=0 
cellSpacing=0 width=70%>
<TBODY>
<TR>
<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>
<TR>
<TD><FONT face="<% =DefaultFontFace %>" size=2>Email</TD>
<TD><FONT face="<% =DefaultFontFace %>" size=3>
<INPUT name=email size=30 type=text value=""></FONT></TD>
</TR>

<TD align=middle colSpan=2><INPUT name=submit1 type=submit 
value=Submit></TD></TR></TBODY></TABLE></FONT></TD></TR></TBODY></TABLE>
<P> </P>

<%
End if 
%>

</body>
</html>

-----------------------------------

Thank you, T

  Return to Index