Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 2 years ago.
开发者_开发问答 Improve this questionI am working on a website. I am new to this field. I've made one website, but I have a problem in the "Contact Us" form.
In this form I made four textboxes, one "reset" button, and one "send" button. The problem is that when I click on that button, mail is not sent. What code do I have to use to send email?
If you want to send emails from a form it would be a good idea to learn about server-side scripts.
I would start by finding out what software you have installed on your current server. Eg: is it a Linux server with Apache, MySQL, PHP, Perl etc... or is it a Windows server with ASP.Net etc... You can find this out from your host provider.
For security reasons I would not recommend writing your own script for sending emails until you know what you are doing. There are freely available scripts that do this fine.
Tectite FormMail is one example if you have PHP
Then you need to be able to upload your required scripts to the web server. Usually FTP access to the server is given for this task. And use the appropriate HTML to communicate with the script.
Alternatively:
There are hosted form options that may be worth checking out so you don't have to learn as much about server scripts. (this means some other web server does the email part all you manage is the HTML)
Here is a list of a few hosted options
Edit: Here is a better list of hosted options
You can use a form processor cgi script on the web server to send the message by email.
Your understanding of how email is sent seems incomplete. Email will not be automatically sent by merely clicking on the submit button (thereby submitting the form). The form has to be submitted to "something", where the "something" is a program that will process the data submitted using the form and do the necessary things to send the data by email.
I don't know which programming languages you are familiar with. If there is any that you are using then you need to find out how to write a CGI script to handle this scenario using your favorite language.
I know I might be little late, but for people reading this post in the future.
You can use SMTP, such as EmailJS which does the backend for you. Just follow the docs.
精彩评论