I have been having problems with this script. It will send the forgot password information to email addresses on our domain, but not to email addresses outside our domain. The script is supposed to get information from the Database and then send it to the email address that it retrieves. We know it is retrieving the info, but not sending it to any outside domains.
Set ocmd = Server.CreateObject("ADODB.Command")
ocmd.ActiveConnection = Application("ConnectString")
ocmd.CommandText = "sp_cx_forgotpassword"
ocmd.CommandType = 4
ocmd.Parameters.Append ocmd.CreateParameter("RETURN_VALUE", 3, 4, 4)
ocmd.Parameters.Append ocmd.CreateParameter("@Name", 200, 1, 16, Request.Form("userid"))
ocmd.Prepared = True
Set rs = Server.CreateObject("ADODB.Recordset")
If ocmd.Parameters("Return_Value") = -1 then
Response.Redirect "ShowMessageOut.asp?Msg=Unfortunately your login name was not found in the system!"
Set Mailer = Server.CreateObject("SMTPsvg.Mailer")
Mailer.FromName = "CX Community portal administrator"
Mailer.FromAddress = Application("FromAddress")
Mailer.RemoteHost = Application("SMTPHost")
Mailer.AddRecipient rs("FirstName")&" "&rs("LastName"), rs("EMail")
Mailer.Subject = "CX Community login information"
Mailer.BodyText = "Dear "&rs("FirstName")&","&VbCrLf&VbCrLf&"Below is your personal login information. Using this information you can log in to CX Community portal."&_
VbCrLf&VbCrLf&"Login Name: "&Request.Form("userid")&VbCrLf&VbCrLf&"Password: "&rs("Password")&_
VbCrLf&VbCrLf&"Thank you, "&VbCrLf&VbCrLf&"CX Community Portal Administrator"
'response.write rs("FirstName")&" "&rs("LastName")&", -"&rs("EMail")&"-
'response.write "sender: "&Mailer.FromAddress
if Mailer.SendMail then
Response.Redirect "ShowMessageOut.asp?Msg=Your login information was successfully sent to your EMail!"
Response.Redirect "ShowMessageOut.asp?Msg=Mail send failure. Error: "&Mailer.Response
Can anyone see anything wrong with this script?
September 26th, 2002, 06:32 PM
Are you sure that the smtp services on the web server are set up to forward external mail to your mail gateway?
I'd check that first, internet services manager > default smtp virtual server > right click and hit properties > delivery tab > advanced button > you need to check the fully qualified domain name box to make sure it is correct and the smart host box should contain the name of the mail server the box will need to contact to send mail externally.
September 26th, 2002, 06:41 PM
Juridian: I just checked with our support people. (Our site is remotely hosted) And they stated that everything was set up correctly.
September 26th, 2002, 07:19 PM
And you are sure that the mail isn't getting created at all? Have they checked the folders (badmail, queue, etc) to see if the mail exists but isn't getting sent?
September 26th, 2002, 07:29 PM
Juridian: The email is being created because it will send emails to any address in the same domain. It will not send to other domains, and that is why I think there is something wrong with the script.
September 26th, 2002, 07:57 PM
What is the Mailer.Sendmail returning? It seems to me that the script is working if it works on your domain, but for some reason it can't get the proper permission or setup to send to an external address.
September 26th, 2002, 07:58 PM
hrm....to me it sounds like a server configuration issue. If it is indeed creating the emails you should just be able to slap on a 'to' address and send it on it's merry way.
Your script looks fine tho I'd rather use cdonts myself to send mail. But using a hosting provider I know how it is with them wanting you to use components they provide.
Last time I had issues like you are having it is because the smtp services on the box did not know where to forward the outgoing (non internal) mail to. All of the mail was sitting in the queue and badmail folders because it didn't know where to go.
September 26th, 2002, 08:13 PM
It gives me the following error : Mail send failure. Error: 503 must have sender and recipient first
September 26th, 2002, 08:22 PM
Ahh...have you tried to response.write the values for the to and from fields and done a response.end when that happens to see what data you are passing to the mail code?
September 26th, 2002, 08:30 PM
Already tried that and I could see that it was pulling the right info from the database.