Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
684 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 Reply

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.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

1.4m articles

1.4m replys

5 comments

57.0k users

...