How to make a form to send letters


Typically, the form of sending an email on a site consists of two main fields: the message header field and the text input field messages. You do not need to specify the email address of the site administrator to the sender, as it is spelled out in the code itself. This option is convenient because the administrator can receive emails without displaying his email address.


The form in which the text will be entered is written in simple html. The code can be something like this:



The above code will create a form with two fields — “Subject” and “Message”. There will also be two buttons, “Send” and “Clear”. You can place this code in a convenient location on the website page. The form will be present, but for now it is still unworkable. To press buttons to result in the desired result, add the following PHP script to the site:
$to = “electronic @адрес “;
mail ($to, “$sub”, $mes);



Instead of the line “electronic @адрес” substitute the desired e-mail. Copy the script to regular “Boknote”, save as send.php (save as send.txt first, then rename the extension to *.php) and put in one folder with the site page. This is the simplest version of the form for sending emails, you can change it and refine it in the way you need. For example, by adding an echo statement to the script, you can display a message after sending a message. You can also change shape sizes, color, button names, etc.

Leave a Comment