Asp Form Mailer

Discussion in 'C#' started by Swordoath, Jun 29, 2008.

  1. #1
    I really need some help with this,
    I've spent hours looking for the answer but I cannot find it hopefully you guys can help.

    I'm trying to create a form with a submit button that mails on godaddy

    Here is the script that is on the form

    <form method="post" action="mailer.asp" name="application" enctype="multipart/form-data" id="Application">
    <input type="hidden" name="sendto" value="casey.w.gibson@gmail.com">
    <input type="hidden" name="subject" value="surgicalmentors.com: Contact
    Form Submission">
    <input type="hidden" name="resulturl" value="http://www.surgicalmentors.com/thanks_app.shtml">
    <input type="submit" name="Submit" value="Submit" />


    It's calling the mailer.asp file here is that code

    <%

    Set Mailer = Server.CreateObject ("SoftArtisans.SMTPMail")
    Mailer.FromName = "Surgical Mentors"
    Mailer.FromAddress = "Surgicalmentors.com"
    Mailer.Subject = "Form Data"
    Mailer.BodyText = "bodytext"
    Mailer.RemoteHost = "127.0.0.1"

    Mailer.AddRecipient "John Smith", "lpbndinfo@verizon.net"
    Mailer.AddCC "casey.w.gibson@gmail.com"
    Mailer.AddCC "Patti Lissberger"
    Mailer.AddCC "lpbndinfo@verizon.net"

    if Mailer.SendMail then
    ' Message sent sucessfully
    response.write ("Your message was sent")
    else
    ' Message send failure
    response.write ("Your message was not sent. ")
    response.write ("The error was: " & Mailer.Response)
    end if
    %>




    It says that the email was sent successfully
    but I never recieve the email into my inbox and when I do it only says bodytext when I need it to retrieve the data in the form
    and when the message is sent I'm wanting it to redirect to this page
    http://www.surgicalmentors.com/thanks_app.shtm
    instead of saying your message was sent successfully

    the mailer.asp is the new one that I rewrote

    here is the original but when I use this one it gives me a error on line 21 saying it needs the mailer.asp

    <%

    bodytext = "A form was filled out on the website. Here are the results:" & VbCrLf & VbCrLf
    For i=1 to Request.Form.Count
    If Left(Request.Form.Key(i),2)<>"x_" Then
    bodytext = bodytext & Request.Form.Key(i) & ": " & Request.Form.Item(i) & VbCrLf & VbCrLf
    End If
    Next

    'make sure the from property gets filled with something
    If Request.Form("email")="" Then
    email = "no-reply@no-reply.com"
    Else
    email = Request.Form("email")
    End If

    'Soft Artisans Version
    Set MyMail = Server.CreateObject("SoftArtisans.SMTPMail")
    MyMail.RemoteHost = "127.0.0.1"
    MyMail.FromAddress = email
    Mailer.AddRecipient = Request.Form("lpbndinfo@verizon.net")
    MyMail.AddCC = "Patti Lissberger"
    MyMail.AddCC = "lpbndinfo@verizon.net"
    MyMail.Subject = Request.Form("subject")
    MyMail.BodyText = bodytext
    If MyMail.SendMail Then
    Response.Redirect Request.Form("resulturl")
    Else
    response.write("Mailer Error. Error was " & MyMail.Response)
    response.end
    End If

    Set MyMail = Nothing
    %>
     
    Swordoath, Jun 29, 2008 IP
  2. Social.Network

    Social.Network Member

    Messages:
    517
    Likes Received:
    15
    Best Answers:
    0
    Trophy Points:
    35
    #2
    The main form is posting to mailer.asp, but it appears that you hard coded most of the email properties. The values entered in the form should be used to set the respective mail properties. The original mailer.asp appears to be right.
     
    Social.Network, Jun 29, 2008 IP
  3. Swordoath

    Swordoath Peon

    Messages:
    2
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    Ya I did hardcode the newer one to test it out to see if it was godaddy's servers or not.

    here is the error I get with the original

    Microsoft VBScript runtime error '800a01a8'

    Object required: 'Mailer'

    /mailer.asp, line 21
     
    Swordoath, Jun 29, 2008 IP
  4. Social.Network

    Social.Network Member

    Messages:
    517
    Likes Received:
    15
    Best Answers:
    0
    Trophy Points:
    35
    #4
    Here is the typo:

    Mailer.AddRecipient = Request.Form("lpbndinfo@verizon.net")

    It should read:

    MyMail.AddRecipient = Request.Form("lpbndinfo@verizon.net")

    Hope this helps!
     
    Social.Network, Jun 29, 2008 IP