Contact form for sending emails via PHP code with open-source PHP library.
Connect PHPMailer with PHP code.
use PHPMailer\PHPMailer\PHPMailer;
require_once "PHPMailer/PHPMailer.php";
require_once "PHPMailer/SMTP.php";
require_once "PHPMailer/Exception.php";
$mail = new PHPMailer();
Include id attributes from contact form.
$name = $_POST['name'];
$email = $_POST['email'];
$subject = $_POST['subject'];
$body = $_POST['body'];
Set up SMTP and EMAIL settings.