Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
687 views
in Technique[技术] by (71.8m points)

create email form using html

I want to create a HTML form to send email. something like this: when the user enter name, email and message, press the send button and the message send to my email address. I searched a lot. but I couldn't find anything useful. thanks a lot

<form id="form" action="mailto:[email protected]" method="post">
     <p class="column col4"><label for="name">Name:</label><input type="text" name="name" id="name" /></p>
     <p class="column col4"><label for="email">E-mail:</label><input type="text" name="email" id="email" /></p>
     <p class="column col8"><label for="message">Message:</label><textarea rows="5" name="message" id="message"></textarea></p>
     <p class="column col8"><input class="button" type="submit" value="Send" /></p>
                        </form>

this doesn't work. after press send button the outlook opens and instead of message i get name=....&message=....

my server support php.

please help me

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

mailto: as a form action is highly unreliable, so much so that it is effectively unusable on the WWW.

You need to set the action to an HTTP (or, preferably, HTTPS) URL and then handle the form submission using a server side technology.

Reading form data and sending email is relatively trivial in any server side programming language. So you could start by seeing what your server supports along those lines and then just using that.

Alternatively, there are (or at least there were last time I looked) third party form mailer services which allow you to set the action to a URL hosted on their site.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...