SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    Addict obliquegeek's Avatar
    Join Date
    Aug 2004
    Location
    England
    Posts
    340
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Contact form advice.

    I've agreed to help a friend with a free project and everything was going fine until they got some free web space from another friend. It's running on windows and everything is ASP. I have never been near ASP and I really don't understand much. I use PHP/apache and even then it's only tinkering.

    I was hoping to find a simple script I could plug in and use as a contact form and one for a mailing list (both form to mail type things). But I can't. I've eventually managed to find a couple but I coulnt'd make any sense of them or get them to work.

    Has anyone got any pointers or advice that might help? Anything would be much appreciated.
    "Everything should be as simple as possible,
    but no simpler" - Albert Einstein

  2. #2
    Original Gangster silver trophy Thing's Avatar
    Join Date
    Oct 2000
    Location
    Philadelphia, PA
    Posts
    4,708
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    Here's a very simple contact form you can use:

    Code:
    <%
    If request.form("submit") <> "" then
     TheBody = "Name: " & request.form("name") & "<BR>"
     TheBody = TheBody & "Email: " & request.form("email") & "<BR>"
     TheBody = TheBody & "Subject: " & request.form("subject") & "<BR>"
     TheBody = TheBody & "Message: " & request.form("message") & "<BR>"
     TheBody = TheBody & "Date: " & now()
     
     Set objEMail = Server.CreateObject("CDO.Message")
     Set objConfig = Server.CreateObject("CDO.Configuration")
     Set Confi = objConfig.Fields
     Confi("http://schemas.microsoft.com/cdo/con...tion/sendusing") = 1
     Confi("http://schemas.microsoft.com/cdo/con...ickupdirectory") = "C:\inetpub\mailroot\pickup"
     Confi.Update
     Set objEMail.Configuration = objConfig
     objEMail.To = "whatever@whatever.com"
     objEMail.From ="whatever@whatever.com"
     objEMail.Subject = "Comment on " & now()
     objEMail.HTMLBody = TheBody
     objEMail.Send
     Set objEMail = Nothing
     response.write "<P>&nbsp;<p align=""center""><strong>Thank you for contacting Us.  Your message has been sent.</strong></p>"
     
    Else
    %>
    <form method="post" value="contact.asp">
     <table align="center" width="70%" border="0">
      <tr>
       <td colspan="2" align="center"><H1>Contact Us</H1><p></td>
      </tr>
      <tr>
       <td colspan="2" align="left">Do you have a question, comment, or suggestion?  We would love to hear from you!  Please fill out the form below and click the "Contact Us" button.</td>
      </tr>
      <tr>
       <td><strong>Name</strong></td>
       <td><input type="text" name="name"></td>
      </tr>
      <tr>
       <td><strong>Email</strong></td>
       <td><input type="text" name="email"></td>
      </tr>
      <tr>
       <td><strong>Subject</strong></td>
       <td><input type="text" name="subject" size="38"></td>
      </tr>
      <tr>
       <td valign="top"><strong>Message</strong></td>
       <td><textarea rows="8" cols="30" name="message"></textarea></td>
      </tr>
      <tr>
       <td colspan="2" align="center"><input type="submit" name="submit" value="Contact Us!"></td>
      </tr>
     </table>
    </form>
    <%End if%>

  3. #3
    Addict obliquegeek's Avatar
    Join Date
    Aug 2004
    Location
    England
    Posts
    340
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanks for the reply, I wasn't expecting someone to just give me something.

    I feel a little bit cheeky but I'm getting an error message when trying to submit;

    CDO.Message.1 error '80040220'

    The "SendUsing" configuration value is invalid.

    /tact.asp, line 20

    Any ideas? It's probably me being a bit dim...

    And thanks again for the response.
    "Everything should be as simple as possible,
    but no simpler" - Albert Einstein


Bookmarks

Posting Permissions

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