Results 1 to 10 of 10

Thread: ASP Help

  1. #1
    AO Decepticon CXGJarrod's Avatar
    Join Date
    Jul 2002
    Posts
    2,038

    ASP Help

    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")
    rs.Open ocmd
    If ocmd.Parameters("Return_Value") = -1 then
    Response.Redirect "ShowMessageOut.asp?Msg=Unfortunately your login name was not found in the system!"
    end if
    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
    'response.end
    if Mailer.SendMail then
    Response.Redirect "ShowMessageOut.asp?Msg=Your login information was successfully sent to your EMail!"
    else
    Response.Redirect "ShowMessageOut.asp?Msg=Mail send failure. Error: "&Mailer.Response
    end if
    %"

    Can anyone see anything wrong with this script?

  2. #2
    Ninja Code Monkey
    Join Date
    Nov 2001
    Location
    Washington State
    Posts
    1,027
    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.
    "When I get a little money I buy books; and if any is left I buy food and clothes." - Erasmus
    "There is no programming language, no matter how structured, that will prevent programmers from writing bad programs." - L. Flon
    "Mischief my ass, you are an unethical moron." - chsh
    Blog of X

  3. #3
    AO Decepticon CXGJarrod's Avatar
    Join Date
    Jul 2002
    Posts
    2,038
    Juridian: I just checked with our support people. (Our site is remotely hosted) And they stated that everything was set up correctly.

  4. #4
    Ninja Code Monkey
    Join Date
    Nov 2001
    Location
    Washington State
    Posts
    1,027
    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?
    "When I get a little money I buy books; and if any is left I buy food and clothes." - Erasmus
    "There is no programming language, no matter how structured, that will prevent programmers from writing bad programs." - L. Flon
    "Mischief my ass, you are an unethical moron." - chsh
    Blog of X

  5. #5
    AO Decepticon CXGJarrod's Avatar
    Join Date
    Jul 2002
    Posts
    2,038
    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.

  6. #6
    Junior Member
    Join Date
    Oct 2001
    Posts
    16
    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.

  7. #7
    Ninja Code Monkey
    Join Date
    Nov 2001
    Location
    Washington State
    Posts
    1,027
    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.
    "When I get a little money I buy books; and if any is left I buy food and clothes." - Erasmus
    "There is no programming language, no matter how structured, that will prevent programmers from writing bad programs." - L. Flon
    "Mischief my ass, you are an unethical moron." - chsh
    Blog of X

  8. #8
    AO Decepticon CXGJarrod's Avatar
    Join Date
    Jul 2002
    Posts
    2,038
    It gives me the following error : Mail send failure. Error: 503 must have sender and recipient first

  9. #9
    Ninja Code Monkey
    Join Date
    Nov 2001
    Location
    Washington State
    Posts
    1,027
    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?
    "When I get a little money I buy books; and if any is left I buy food and clothes." - Erasmus
    "There is no programming language, no matter how structured, that will prevent programmers from writing bad programs." - L. Flon
    "Mischief my ass, you are an unethical moron." - chsh
    Blog of X

  10. #10
    AO Decepticon CXGJarrod's Avatar
    Join Date
    Jul 2002
    Posts
    2,038
    Already tried that and I could see that it was pulling the right info from the database.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •