SitePoint Sponsor

User Tag List

Results 1 to 6 of 6
  1. #1
    Knowledge is key 2 progression Tryst's Avatar
    Join Date
    Sep 2003
    Location
    Wales
    Posts
    1,181
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Sending an Email via a HTML <FORM>

    Hi all,

    Is it possible to use a HTML web <FORM> to send an email? I was thinking that maybe an email address can be specified as a value of the 'ACTION' attribute and then send the data in the form to the email address given

    Cheers all

    Tryst

  2. #2
    He's No Good To Me Dead silver trophybronze trophy stymiee's Avatar
    Join Date
    Feb 2003
    Location
    Slave I
    Posts
    23,423
    Mentioned
    2 Post(s)
    Tagged
    1 Thread(s)
    You can have a form submit to you directly without CGI or JavaScript. Just set your form tag to look like this:

    <form method="post" enctype="text/plain" action="mailto:email@domain.com" onSubmit="doSomething()">

    This will cause the contents of your form to be sent to you via email. However, since the form won't appear as if it has done anything, you'll need JavaScript to let the user know it worked or to redirect them to a new page.

  3. #3
    SitePoint Zealot
    Join Date
    Jan 2004
    Location
    Holland
    Posts
    141
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Bad idea

    Including a mail adress on a web page like that is just about the best way to invite spammers to flood your mailbox. Besides that, recent experience has shown that mailing a form like this won't work on all clients; specifically, some WinXP clients have had trouble with it.
    The safest and sturdiest way to have a form mailed to you still is using a - simple - form handler. If your server supports PHP, this can very easily be achieved with a little PHP code of which many examples are available on PHP development sites. Alternatively, you could you use the - often free - services of a form handling application.
    Regards,
    Ronald.

  4. #4
    Knowledge is key 2 progression Tryst's Avatar
    Join Date
    Sep 2003
    Location
    Wales
    Posts
    1,181
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Just out of curiosity, through exactly what email sever will the email be sent when using a HTML form?

    Cheers guys

    Tryst

  5. #5
    Grumpy Mole Man Skunk's Avatar
    Join Date
    Jan 2001
    Location
    Lawrence, Kansas
    Posts
    2,067
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Don't do this. Setting a mailto: address as the action of a form will only work for users who have configured their email client to work along side their browser on their local machine. This excludes everyone who uses web-based email services such as Hotmail as their main email addresses. How many people do you know who use Hotmail for their email? It's probably a pretty big number.

    If you want a form to be submitted by email, you need to use a server-side form to email script such as FormMail.

  6. #6
    Knowledge is key 2 progression Tryst's Avatar
    Join Date
    Sep 2003
    Location
    Wales
    Posts
    1,181
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Ahh OK.

    Cheers for the fountain of knowledge guys.

    I fully understand now

    Tryst


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
  •