www.webdeveloper.com
Results 1 to 6 of 6

Thread: Email form

  1. #1
    Join Date
    Jan 2005
    Posts
    4

    Email form

    I am a newbie using java script forms.

    I need an email form so that people can click a button, and their default email application will come up, with the "Send to" filled out with my email address.

    For example, if my email address is: mike@test.com

    And my html page has this on it:

    *Please contact Mike with any questions - <flash button that says Email Mike>*

    I have seen lots of form scripts for stuff like this, but I have no idea how to actually implement the script, where to put it, etc. Every explanation I've seen assumes a level of understanding that I do not have apparently, because all of my attempts have failed. I follow the instructions (I think) and it never works. My email application never comes up when I click the button. I just get an html page that says - page not found, or something to that effect.

    Thanks

  2. #2
    Join Date
    May 2004
    Location
    Manhattan NY
    Posts
    6,028
    If you want what you said, you don't need JS at all. Do you want a link to email to you, or do you want a form filled out and have that mailed to you?

    If all you want is an email to come up with your addy in the "to", then do this:

    <a href="mailto:mike@test.com">CLICK HERE</a>

    if you want a form mailed, then:

    <form method="post" name="mail" action="mailto:mike@test.com?subject=customers" enctype="text/plain">

  3. #3
    Join Date
    Dec 2004
    Posts
    8,637
    Originally posted by Trigolt
    I need an email form so that people can click a button, and their default email application will come up ...
    What if they have no "default" email application at all?

    Otherwise, there is no script required for this.
    You just need a standard HTML form:
    Code:
    <form method="get" action="mailto&#58;mike@test.com">
      <fieldset>
        <input type="hidden" name="subject" alt="email subject" value="Re:Questions">
        <input type="submit" name="emailme" alt="email submit" value="Email Mike">
      </fieldset>
    </form>
    Last edited by phpnovice; 01-25-2005 at 05:46 PM.

  4. #4
    Join Date
    Nov 2002
    Location
    Auburn, AL
    Posts
    9,222
    Using a form like this though is only going to work for clients who have a mail client running on their system, it could easily fail for someone who is using webmail. It is better to use a server side language and an smtp server to send the mail if that is available to you.

  5. #5
    Join Date
    Dec 2004
    Posts
    8,637
    That is true. However, since they specifically stated that they wanted the visitor's email application to be involved, that seemed to indicate to me that server-side code was not an option. Therefore, I did not include that caveat. I've now edited my post to include what I should have said in the first place.

  6. #6
    Join Date
    Jan 2005
    Location
    Lithia Springs, GA USA
    Posts
    886
    Originally posted by phpnovice
    What if they have no "default" email application at all?
    i agree with them... What if your user doesn't have an email client how will they contact you?

    I think a simple 3 field form with a small php script would be best suited for this imho.

    If you would like I have a simple example I can send you and run you through it to make sure it works.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

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



Recent Articles