Emailing forms

Posted on 2007-10-12
Last Modified: 2010-04-09
Is it possible to email forms in an email. For example I want to create a contact book in which can be updated by me emailing that person a form in which they can fill out and submit by email right there on the spot.
Question by:eteran
    LVL 13

    Expert Comment

    Sure it can.. if the client supports this type of HTML though. Just point the action attribute of the form to your absolute web address http://( and your ready to go :)
    LVL 9

    Expert Comment


    'Configure Mail object
    Dim CDO                  : Set CDO = Server.CreateObject("CDO.Message")
    Dim CDOConfig      : Set CDOConfig = Server.CreateObject("CDO.Configuration")
    Dim urn             : urn = ""
    With CDOConfig
          .Fields(urn & "sendusing") = 2
          .Fields(urn & "smtpserver") = ""
          .Fields(urn & "smtpserverport") = 25
          .Fields(urn & "smtpconnectiontimeout") = 60
    End With
    For Each formField in Request.Form
      MSG = MSG & formField & ": " & Request.Form(formField)
    With CDO
      .To = ""
      .From = ""
      .Subject = "Form Details"
      .TextBody = MSG 'Send the above formatted body
      .Send() 'Send the message
    End With
    Set CDO = Nothing
    Set CDOConfig = Nothing

    Author Comment

    okay in the event the user can not view the form is there a way a link can come out or something. I know most email clients do not like java nore asp in th content.
    LVL 9

    Expert Comment

    Well, that's not true 'most email clients do not like...asp in th content.'

    ASP is a server side only techonology. Active Server Pages. ASP is just a method in which the server creates dynamic information for the client browser.

    This is how this should work.....

    Put your contact form on a page. That page doesn't have to be an asp page, it could just be a plain HTM page.

    Set the action attribute of the form to sent.asp (or thanks.asp or whatever...jsut make sure it's .asp)

    Put the code I posted at the top of the .asp page, and fill in the rest of the page with whatever HTML you want.

    The code I posted will work as long as your server has had IIS correctly installed. If it's a ChiliSoft/Apache server, I'm not 100% sure what their ASP processor does for mail.
    LVL 4

    Expert Comment

    Onthrax is right onthe money. Just send your form in an email and have it post to whatever page you are going to use to process it. Just be aware that not all email programs support html or may not support forms.


    Author Comment

    My question is now should my approch be that way or should I just put a link on the page to go update there contact information. What is going to be more effective. Is there also a way to detect if the email client can view forms or not.
    LVL 13

    Accepted Solution

    There are a few options.

    - You could present an option when people register if they can accept html mails or not. Then using that setting you can automatically determine if the mail should contain a form or link.
    - A second option is to insert a link in the mail that will automatically log them in and go to the page containing the form. Although this could present a possible security breach (depending on what kind of site you have) it is most user friendly.

    There is no 'better' solution. It's what you prefer yourself that will work.

    Hope this helps :)

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Looking for New Ways to Advertise?

    Engage with tech pros in our community with native advertising, as a Vendor Expert, and more.

    Suggested Solutions

    Deprecated and Headed for the Dustbin By now, you have probably heard that some PHP features, while convenient, can also cause PHP security problems.  This article discusses one of those, called register_globals.  It is a thing you do not want.  …
    Showing your events from Google Calendar in Google Maps Why? I travel all week and I thought it would be ideal if staff in office knew where I was based on my calendar. (OK real reason: my son wanted to see where I would be working, and I thoug…
    In this tutorial viewers will learn how to style transparent/translucent elements using alpha transparency in CSS Start with a normal styled element, such as a div.: Define its "background-color" property as "rgba (255, 255, 255, .5): The numbers in…
    In this tutorial viewers will learn how to style elements, such a divs, with a "drop shadow" effect using the CSS box-shadow property Start with a normal styled element, such as a div.: In the element's style, type the box shadow property: "box-shad…

    761 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    6 Experts available now in Live!

    Get 1:1 Help Now