<div class="container">
<form id="signup" method="post" action="<?php $_PHP_SELF ?>">
<h1>Join US!.</h1>
<input type="email" placeholder="sampleemail@gmail.com" name="userEmail" required="">
<input value="Sign up for free!" type="submit" style="background-color: #98FB98"></input>
</form>
</div>
I have this code in my page or UI and when a user enters a email how can I put the entered email in my message using PHPMailer, I have my code for mailing using PHPMailer. I tried using post but it's not working(sorry for my bad english)
<?php
require 'PHPMailerAutoload.php';
include 'util/completeregvalidation.php';
$mail = new PHPMailer;
//$mail->SMTPDebug = 3; // Enable verbose debug output
$mail->isSMTP(); // Set mailer to use SMTP
$mail->Host = 'smtp.gmail.com'; // Specify main and backup SMTP servers
$mail->SMTPAuth = true; // Enable SMTP authentication
$mail->Username = 'sample@gmail.com'; // SMTP username
$mail->Password = 'sampleacc'; // SMTP password
$mail->SMTPSecure = 'tls'; // Enable TLS encryption, `ssl` also accepted
$mail->Port = 587; // TCP port to connect to
$mail->setFrom($emailval, 'Mailer');
$mail->addAddress('vega.residences@gmail.com', 'Joe User'); // Add a recipient
//$mail->addAddress('ellen@example.com'); // Name is optional
//$mail->addReplyTo('info@example.com', 'Information');
//$mail->addCC('cc@example.com');
//$mail->addBCC('bcc@example.com');
//$mail->addAttachment('/var/tmp/file.tar.gz'); // Add attachments
//$mail->addAttachment('/tmp/image.jpg', 'new.jpg'); // Optional name
$mail->isHTML(true); // Set email format to HTML
$mail->Subject = 'Confirm Registration';
$mail->Body = "Please confirm registration.". ($_POST['userEmail']);
$mail->AltBody = 'This is the body in plain text for non-HTML mail clients';
if(!$mail->send()) {
echo 'Message could not be sent.';
echo 'Mailer Error: ' . $mail->ErrorInfo;
} else {
header('Location: ../pages/checkemail.php');
}
?>
This is my code in phpmailer.