Search
 
SCRIPT & CODE EXAMPLE
 

PHP

send email when form is submitted php

<?php 
if(isset($_POST['submit'])){
    $to = "email@example.com"; // this is your Email address
    $from = $_POST['email']; // this is the sender's Email address
    $first_name = $_POST['first_name'];
    $last_name = $_POST['last_name'];
    $subject = "Form submission";
    $subject2 = "Copy of your form submission";
    $message = $first_name . " " . $last_name . " wrote the following:" . "

" . $_POST['message'];
    $message2 = "Here is a copy of your message " . $first_name . "

" . $_POST['message'];

    $headers = "From:" . $from;
    $headers2 = "From:" . $to;
    mail($to,$subject,$message,$headers);
    mail($from,$subject2,$message2,$headers2); // sends a copy of the message to the sender
    echo "Mail Sent. Thank you " . $first_name . ", we will contact you shortly.";
    // You can also use header('Location: thank_you.php'); to redirect to another page.
    }
?>

<!DOCTYPE html>
<head>
<title>Form submission</title>
</head>
<body>

<form action="" method="post">
First Name: <input type="text" name="first_name"><br>
Last Name: <input type="text" name="last_name"><br>
Email: <input type="text" name="email"><br>
Message:<br><textarea rows="5" name="message" cols="30"></textarea><br>
<input type="submit" name="submit" value="Submit">
</form>

</body>
</html> 
Comment

send email in php

<?php
    ini_set( 'display_errors', 1 );
    error_reporting( E_ALL );
    $from = "test@hostinger-tutorials.com";
    $to = "test@hostinger.com";
    $subject = "Checking PHP mail";
    $message = "PHP mail works just fine";
    $headers = "From:" . $from;
    if(mail($to,$subject,$message, $headers)) {
		echo "The email message was sent.";
    } else {
    	echo "The email message was not sent.";
    }
Comment

how to send email in html form using php

// multiple recipients
$to  = 'aidan@example.com' . ', '; // note the comma
$to .= 'wez@example.com';

// subject
$subject = 'Birthday Reminders for August';

// message
$message = '
<html>
<head>
  <title>Birthday Reminders for August</title>
</head>
<body>
  <p>Here are the birthdays upcoming in August!</p>
  <table>
    <tr>
      <th>Person</th><th>Day</th><th>Month</th><th>Year</th>
    </tr>
    <tr>
      <td>Joe</td><td>3rd</td><td>August</td><td>1970</td>
    </tr>
    <tr>
      <td>Sally</td><td>17th</td><td>August</td><td>1973</td>
    </tr>
  </table>
</body>
</html>
';

// To send HTML mail, the Content-type header must be set
$headers  = 'MIME-Version: 1.0' . "
";
$headers .= 'Content-type: text/html; charset=iso-8859-1' . "
";

// Additional headers
$headers .= 'To: Mary <mary@example.com>, Kelly <kelly@example.com>' . "
";
$headers .= 'From: Birthday Reminder <birthday@example.com>' . "
";
$headers .= 'Cc: birthdayarchive@example.com' . "
";
$headers .= 'Bcc: birthdaycheck@example.com' . "
";

// Mail it
mail($to, $subject, $message, $headers);
Comment

send email when form is submitted php


<!DOCTYPE html>
<html>
<head>
<title>FeedBack Form With Email Functionality</title>
<link href="css/elements.css" rel="stylesheet">
</head>
<!-- Body Starts Here -->
<body>
<div class="container">
<!-- Feedback Form Starts Here -->
<div id="feedback">
<!-- Heading Of The Form -->
<div class="head">
<h3>FeedBack Form</h3>
<p>This is feedback form. Send us your feedback !</p>
</div>
<!-- Feedback Form -->
<form action="#" id="form" method="post" name="form">
<input name="vname" placeholder="Your Name" type="text" value="">
<input name="vemail" placeholder="Your Email" type="text" value="">
<input name="sub" placeholder="Subject" type="text" value="">
<label>Your Suggestion/Feedback</label>
<textarea name="msg" placeholder="Type your text here..."></textarea>
<input id="send" name="submit" type="submit" value="Send Feedback">
</form>
<h3><?php include "secure_email_code.php"?></h3>
</div>
<!-- Feedback Form Ends Here -->
</div>
</body>
<!-- Body Ends Here -->
</html>
Copy
Comment

Sending an php website email form

 
<form method="post" action="subscriberform.php">
<textarea name="message"></textarea>
<input type="submit">
</form>
Comment

send email php form

<form>
<h2>Contact us</h2>
<p><label>First Name:</label> <input name="myEmail" type="text" /></p>
<p><label>Email Address:</label> <input style="cursor: pointer;" name="myEmail" type="text" /></p>
<p><label>Message:</label>  <textarea name="message"></textarea> </p>
<p><input type="submit" value="Send" /></p>
</form>
Comment

PREVIOUS NEXT
Code Example
Php :: drupal 7 entity_metadata_wrapper bundle 
Php :: laravel gigapay create payout 
Php :: wordpress wp_head 
Php :: valid number in excel php 
Php :: laravel store multiple files 
Php :: different days in carbon laravel between different dates 
Php :: show html as text in php 
Php :: How to read session in laravel 
Php :: array flip php 
Php :: centos search directory php.exe 
Php :: laravel faker examples 
Php :: php array order by date 
Php :: xdebug vscode docker 
Php :: errno: 150 foreign key constraint is incorrectly formed laravel 8 
Php :: php get domain name with https 
Php :: laravel check if session variable exists 
Php :: vue mouseover 
Php :: create session in php 
Php :: php form examples tutorials with code 
Php :: laravel collection remove duplicates 
Php :: start php server 
Php :: how to add woocommerce cart counter 
Php :: How to copy all files from one folder to another in PHP? 
Php :: adding column to array php 
Php :: php add one day to date 
Php :: laravel display old value in form 
Php :: Laravel Validation check array size min and max 
Php :: case statement in php 
Php :: confirm password validation in laravel 
Php :: php remove charictors from a string 
ADD CONTENT
Topic
Content
Source link
Name
5+6 =