php tutorial - Send an Email on Form Submission Using PHP - php programming - learn php - php code - php script
- Sending Mail to specific email becomes a global issue for website development. Online communication for any organisation with customers or users is done either by emailing them or through comments. These organisations or companies uses feedback or contact form to communicate with users.
- Through these forms user is able to send his/her suggestion or feedback via email to respective organisation.
- Here, In this blog we will show you, how to use mail() function of PHP to send informations like, suggestions/messages to specific email address on form submission.
we used following PHP mail() function with four parameters to send email as follows:
- Here, $to variable is to store reciever’s email id.
- $subject is a variable to store mail subject.
- $message is a variable to store user’s message.
- $headers contains other email parameters like BCc, Cc etc.
You can download our zip file or simply follow our code and edit it to use.
jQuery Contact Form
Learn php - php tutorial - content-feedback-form - php examples - php programs
Most of the new host company has stopped PHP (mail) functioning, because using this spammer can send a thousand of emails. If your host not enabled with PHP mail function you can send using PHP Mailer Class.
HTML file: secure_email_form.php
Here, we have created a simple html Feedback Form as shown below.
PHP File: secure_email_code.php
As User fills the above Html form and clicks on send button, following php code will executes.
CSS File: elements.css
Styling HTML form is done here.