Answered
send email with forgotten password
I am new to this, but I really have been trying to learn
about this, so please bear with me while I hope I ask my question
in a way you can understand what I am asking. What I am trying to
do is build a simple page with one a form, one text box, and one
button. In the text box the user will supply his/her name and upon
hitting the submit button the user will be sent a password to
his/her email address they supplied with when they registered with
our company. Sounds simple right? Well, for me it has turned into a
major headache.
I am working with a asp code and using CDOSYS to mail my request. I have attached the code so you can reveiw it and see if you have any solutions.
<%@LANGUAGE="VBSCRIPT"%>
<!--#include file="Connections/register.asp" -->
<%
Dim rsgetpassword__MMColParam
rsgetpassword__MMColParam = "1"
If (Request.Form("txtusername") <> "") Then
rsgetpassword__MMColParam = Request.Form("txtusername")
End If
%>
<%
Dim rsgetpassword
Dim rsgetpassword_numRows
Set rsgetpassword = Server.CreateObject("ADODB.Recordset")
rsgetpassword.ActiveConnection = MM_register_STRING
rsgetpassword.Source = "SELECT Password, Email FROM dbo.UserNames WHERE UserName = '" + Replace(rsgetpassword__MMColParam, "'", "''") + "' ORDER BY UserName ASC"
rsgetpassword.CursorType = 0
rsgetpassword.CursorLocation = 2
rsgetpassword.LockType = 1
rsgetpassword.Open()
rsgetpassword_numRows = 0
%>
<%
If rsgetpassword.BOF AND rsgetpassword.EOF Then
response.redirect("forgotpassword2.asp")
End If
%>
<%
Set myMail=CreateObject("CDO.Message")
myMail.Configuration.Fields.Item(" http://schemas.microsoft.com/cdo/configuration/sendusing") = 1
myMail.Configuration.Fields.Item(" http://schemas.microsoft.com/cdo/configuration/smtpserver")="SMTP Server"
myMail.Configuration.Fields.Item(" http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 25
myMail.Configuration.Fields.Update
myMail.Subject = "Site Name > Here is your Password!"
myMail.From = "someone@somewhere.org"
myMail.To = rsgetpassword.Fields.Item("Email").Value
myMail.TextBody = "password: " & rsgetPassword.Fields.Item("Password").Value & vbcrlf
myMail.Send
set myMail=nothing
%>
I am not getting any errors, but there is not any emails being sent either.
myMail.Configuration.Fields.Item(" http://schemas.microsoft.com/cdo/configuration/sendusing") = 2
I have tried changing my code to a remote server connection and adding in the mail servers IP address. When I do this my page fails totally and the only error I get is error 500. Which tells me there is a programming or server error. Please help me.
I am working with a asp code and using CDOSYS to mail my request. I have attached the code so you can reveiw it and see if you have any solutions.
<%@LANGUAGE="VBSCRIPT"%>
<!--#include file="Connections/register.asp" -->
<%
Dim rsgetpassword__MMColParam
rsgetpassword__MMColParam = "1"
If (Request.Form("txtusername") <> "") Then
rsgetpassword__MMColParam = Request.Form("txtusername")
End If
%>
<%
Dim rsgetpassword
Dim rsgetpassword_numRows
Set rsgetpassword = Server.CreateObject("ADODB.Recordset")
rsgetpassword.ActiveConnection = MM_register_STRING
rsgetpassword.Source = "SELECT Password, Email FROM dbo.UserNames WHERE UserName = '" + Replace(rsgetpassword__MMColParam, "'", "''") + "' ORDER BY UserName ASC"
rsgetpassword.CursorType = 0
rsgetpassword.CursorLocation = 2
rsgetpassword.LockType = 1
rsgetpassword.Open()
rsgetpassword_numRows = 0
%>
<%
If rsgetpassword.BOF AND rsgetpassword.EOF Then
response.redirect("forgotpassword2.asp")
End If
%>
<%
Set myMail=CreateObject("CDO.Message")
myMail.Configuration.Fields.Item(" http://schemas.microsoft.com/cdo/configuration/sendusing") = 1
myMail.Configuration.Fields.Item(" http://schemas.microsoft.com/cdo/configuration/smtpserver")="SMTP Server"
myMail.Configuration.Fields.Item(" http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 25
myMail.Configuration.Fields.Update
myMail.Subject = "Site Name > Here is your Password!"
myMail.From = "someone@somewhere.org"
myMail.To = rsgetpassword.Fields.Item("Email").Value
myMail.TextBody = "password: " & rsgetPassword.Fields.Item("Password").Value & vbcrlf
myMail.Send
set myMail=nothing
%>
I am not getting any errors, but there is not any emails being sent either.
myMail.Configuration.Fields.Item(" http://schemas.microsoft.com/cdo/configuration/sendusing") = 2
I have tried changing my code to a remote server connection and adding in the mail servers IP address. When I do this my page fails totally and the only error I get is error 500. Which tells me there is a programming or server error. Please help me.