Yann63 Posted July 23, 2020 Share Posted July 23, 2020 Hello, I am a PHP beginner and I made a PHP page which inserts data into a MYSql database. .... $InsertQuery->Action = "insert"; $InsertQuery->Table = "klanten"; $InsertQuery->bindColumn("Klantnummer", "s", "".strtoupper(((isset($_POST["Klantnummer"]))?$_POST["Klantnummer"]:"")) ."", "WA_DEFAULT"); $InsertQuery->bindColumn("Naam_organisatie", "s", "".strtoupper(((isset($_POST["Naam_organisatie"]))?$_POST["Naam_organisatie"]:"")) ."", "WA_DEFAULT"); $InsertQuery->bindColumn("Adres_organisatie", "s", "".strtoupper(((isset($_POST["Adres_organisatie"]))?$_POST["Adres_organisatie"]:"")) ."", "WA_DEFAULT"); $InsertQuery->bindColumn("Postcode_organisatie", "s", "".strtoupper(((isset($_POST["Postcode_organisatie"]))?$_POST["Postcode_organisatie"]:"")) ."", "WA_DEFAULT"); $InsertQuery->bindColumn("Woonplaats_organisatie", "s", "".strtoupper(((isset($_POST["Woonplaats_organisatie"]))?$_POST["Woonplaats_organisatie"]:"")) ."", "WA_DEFAULT"); $InsertQuery->bindColumn("BTW_plichtig", "s", "".strtoupper(((isset($_POST["BTW_plichtig"]))?$_POST["BTW_plichtig"]:"")) ."", "WA_DEFAULT"); $InsertQuery->bindColumn("Email", "s", "".strtoupper(((isset($_POST["Email"]))?$_POST["Email"]:"")) ."", "WA_DEFAULT"); ... After the insert, I want to send all the data with a mail to a recepient. But I can't find a way to code the "setForm" correctly with the inserted field "Email". <?php error_reporting(E_ALL); use PHPMailer\PHPMailer\PHPMailer; use PHPMailer\PHPMailer\src\Exception; require 'PHPMailer\PHPMailer\src\Exception.php'; require 'PHPMailer\PHPMailer\src\PHPMailer.php'; require 'PHPMailer\PHPMailer\src\SMTP.php'; $mail = new PHPMailer(); $mail->IsSMTP(); $mail->Host = "smtp.myhosting.be"; $mail->SMTPAuth = true; $mail->Username = 'username@domain.com'; $mail->Password = 'password'; $mail->setFrom = $_POST('Email'); // doesn't work $mail->AddAddress('recipient@domain.com'); $mail->Subject = "subject"; $mail->Body = "text"; // in the body I want an overview of all the inserted data $mail->IsHTML(true); if(!$mail->Send()) { echo "Error sending: " . $mail->ErrorInfo;; } $mail->ClearAddresses(); $mail->ClearAttachments(); ?> How can I do that? Thank you in advance for your comments. Quote Link to comment Share on other sites More sharing options...
chhorn Posted July 23, 2020 Share Posted July 23, 2020 setFrom is a function $mail->setFrom('from@example.com', 'Mailer'); have a look at the documentation https://github.com/PHPMailer/PHPMailer Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.