In this article I will guide you to create a simple email form using html and php. The form is created using html and the mail is sent using php code.
Let’s take a brief look at php mail() function
The mail() function is used to send email from a web page in php.
Syntax : mail(to,subject,message,headers,parameters);
|to||specifies the email of the recipient (required)|
|headers||specifies additional headers like From, Cc, and Bcc etc. (optional)|
|message||message to be sent (required)|
|parameters||specifies additional parameters (optional)|
|subject||subject of the email (required)|
Create a new file named mailform.php and copy all the code below to the file. You can customize this example according to your web design.
Note! This example will not work on ‘localhost’ WampServer or XAMPP. It works only on a real web server. So upload this file to your blog or web server to see the results.