SMTPDebug = SMTP::DEBUG_SERVER; //Enable verbose debug output
$mail->isSMTP(); //Send using SMTP
$mail->Host = 'in-v3.mailjet.com'; //Set the SMTP server to send through
$mail->SMTPAuth = true;
$mail->Username = '81beb205b1d9a4190b9acb3fa94fc024';
$mail->Password = 'ec979bd6ac550f5c141148665c0e4296';
$mail->SMTPSecure = PHPMailer::ENCRYPTION_STARTTLS; //Enable TLS encryption; `PHPMailer::ENCRYPTION_SMTPS` encouraged
$mail->Port = 587; //TCP port to connect to, use 465 for `PHPMailer::ENCRYPTION_SMTPS` above
//Recipients
$mail->setFrom('contact@luke-else.co.uk');
$mail->addAddress('contact@luke-else.co.uk'); //Add a recipient
//Content
$mail->isHTML(true); //Set email format to HTML
$mail->Subject = 'Website Contact Form: ' . $_POST['email'];
$mail->Body =
'
Name: ' . $_POST['name'] .
'
E-Mail: ' . $_POST['email'] .
'
Message:
' . $_POST['message'];
$mail->send();
} catch (Exception $e) {
// error_log($e);
// echo "Message could not be sent. Mailer Error: {$mail->ErrorInfo}";
http_response_code(500);
}
}else{
http_response_code(500);
}
?>