Trying to set up emailing from a form - ASP

Discussion in 'Email' started by galeswebdesign, Feb 23, 2011.

  1. I'm trying to send myself the email from a contact form. I used the link I found in a different post (http://support.Winhost.com/KB/a683/persits-aspemail-sample-code.aspx), but I'm not sure how to fill everything out.

    I get this error message: Mail send failure. Error was 535 Authentication failed

    Do I need the username and password? Is the password the same as the one I use to log into Winhost? Did I get the Host right?

    This is the code I have so far:

    <%
    Set Mailer = Server.CreateObject("Persits.MailSender")
    Mailer.Host = "mail.galeswebdesign.com"
    Mailer.Username = "galesweb"
    Mailer.Password = "MyWinhostLoginPassword"
    Mailer.FromName = "[email protected]"
    Mailer.From = "[email protected]"
    Mailer.AddAddress "[email protected]"
    Mailer.Subject = "Contact from " & cStr(Request("name"))
    Mailer.Body = "Name: " & cStr(Request("name")) & VbCrLf & "Company Name: " & cStr(Request("companyname")) & VbCrLf & "Email: " & cStr(Request("email")) & VbCrLf & "Phone: " & cStr(Request("phone")) & VbCrLf & "Website: " & cStr(Request("website")) & VbCrLf & "Comment: " & cStr(Request("comment"))

    ' catch errors
    On Error Resume Next
    Mailer.Send
    If Err <> 0 Then ' error occurred
    Response.Write "Mail send failure. Error was " & Err.Description
    else
    Response.Redirect "http://www.galeswebdesign.com"
    End If
    %>

    Thanks for your help.
     
    Last edited by a moderator: Oct 14, 2015
  2. Ray

    Ray

    it looks like the user name is incorrect. The user name is the full email address of the POP account you will access with the password associated to that POP account.
     
  3. That worked, thanks!
     
  4. This was a very helpful thread, but was wondering how I could get it to display "Message sent" and then redirect back to the homepage.

    The original was
    Response.Write "Mail sent..."

    I tried
    Response.Redirect "http://www.homepage.com"

    Both worked, but how can I combine these 2?
     
  5. bump
    can any mods help me with this???
     
  6. Ray

    Ray

    Actually the best way to do this is to setup a "Close" button at the bottom of the page. The close button will close the current browser page that has "Message Sent" message and redirect back to the home page.
     

Share This Page