У меня есть форма PHP (Wilio - Survey и Multipurpose Form Wizard), отправляющая электронные письма отправителю и администратору, она не связана с базой данных, моя цель - как только пользователь отправит свои данные, форма отправит их непосредственно по почте в видевложение слова без каких-либо дополнительных шагов.
вот код HTML
<form id="wrapped" method="POST">
<input id="website" name="website" type="text" value="">
<div id="middle-wizard">
<div class="step">
<h3 class="main_question"><strong>1/2</strong>Please fill the below</h3>
<div class="form-group">
<input type="text" name="student_name" class="form-control required" placeholder="Student Name" onchange="getVals(this, 'student_name');">
</div>
<div class="form-group">
<input type="text" name="school_name" class="form-control required" placeholder="School Name" onchange="getVals(this, 'school_name');">
</div>
<div class="form-group">
<input type="text" name="teacher_name" class="form-control required" placeholder="Teacher Name" onchange="getVals(this, 'teacher_name');">
</div>
<div class="form-group">
<input type="text" name="class_name" class="form-control required" placeholder="Class" onchange="getVals(this, 'class_name');">
</div>
<div class="form-group">
<input type="email" name="email" class="form-control required" placeholder="Your Email" onchange="getVals(this, 'email');">
</div>
<div class="form-group">
<input type="number" name="mobile_number" class="form-control required" placeholder="Mobile Number" onchange="getVals(this, 'mobile_number');">
</div>
</div>
<div class="submit step">
<h3 class="main_question"><strong>2/2</strong>Summary</h3>
<div class="summary">
<ul>
<li><strong>1</strong>
<h5>Personal Details</h5>
<ul>
<li><label>Student Name</label>: <span id="student_name"></span></li>
<li><label>Mobile Number</label>: <span id="mobile_number"></span></li>
<li><label>Email</label>: <span id="email"></span></li>
</ul>
</li>
<li><strong>2</strong>
<h5>Educational Details</h5>
<ul>
<li><label>School Name</label>: <span id="school_name"></span></li>
<li><label>Teacher Name</label>: <span id="teacher_name"></span></li>
<li><label>Class</label>: <span id="class_name"></span></li>
</ul>
</li>
</ul>
</div>
</div>
</div>
<div id="bottom-wizard">
<button type="button" name="backward" class="backward">Prev</button>
<button type="button" name="forward" class="forward">Next</button>
<button type="submit" name="process" class="submit">Submit</button>
</div>
</form>
и вот код PHP
<?php
$mail = $_POST['email'];
$to = "my-email@my-domain.com";
$subject = "Appreciation Certificate";
$headers .= 'MIME-Version: 1.0' . "\r\n";
$headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";
$headers .= "From: Education Council <noreply@my-domain.com>";
$message .= '<div style="text-align: center;"><img src="http://www.my-domain.com/testmail/html/img/banner.jpg" alt="Education Council Banner" /></div>';
$message .= "<h1 style='text-align: center;'>Appreciation Certificate</h1>";
$message .= "\n\n<h2 style='text-align: center;'>World Teachers Day</h2>";
$message .= "\n\n<h1 style='text-align: center;'>It's good to appreciate others for their excellence, efforts and giving</h1>";
$message .= "\n\n<h1 style='text-align: center;'>Student: </h1>" . $_POST['student_name'];
$message .= "\n\n<h1 style='text-align: center;'>School: </h1>" . $_POST['school_name'];
$message .= "\n\n<h1 style='text-align: center;'>My thanks and gratitude to my teacher</h1>";
$message .= $_POST['teacher_name'];
$message .= "\n\n<h1 style='text-align: center;'>On the occasion of World Teachers Day 2019</h1>";
$message .= "\n\n<h2 style='text-align: center;'>Hoping for them permanence excellence and giving</h2>";
$message .= "\n\n<h2 style='text-align: center;'>The Education Council</h2>";
//Receive Variable
$sentOk = mail($to,$subject,$message,$headers);
//Confirmation page
$user = "$mail";
$usersubject = "Appreciation Certificate";
$userheaders .= 'MIME-Version: 1.0' . "\r\n";
$userheaders .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";
$userheaders .= "From: Education Council <noreply@my-domain.com>\n";
$usermessage = "$message";
mail($user,$usersubject,$usermessage,$userheaders,$headers);
?>
надеюсь найти помощь.