TeleQom.org/php/contact.php

48 lines
1.6 KiB
PHP

<?php
use PHPMailer\PHPMailer\PHPMailer;
use PHPMailer\PHPMailer\SMTP;
use PHPMailer\PHPMailer\Exception;
require 'PHPMailer/src/Exception.php';
require 'PHPMailer/src/PHPMailer.php';
require 'PHPMailer/src/SMTP.php';
$lang_folder = $_GET['contact-language']=="en"?"/pages/en/":"/pages/fr/";
if(!filter_var($_GET['contact-email'], FILTER_VALIDATE_EMAIL) || strlen($_GET['contact-message'])==0 || strlen($_GET['contact-name'])==0 || $_GET['contact-email-2'] != ""){
header("Location: ".$lang_folder."err/contact.html");
die();
}
$receiver_email = "vincentmd@protonmail.com";
$message = "Contact: ".$_GET['contact-name']."\nEmail: ".$_GET['contact-email']."\nMessage:\n".$_GET['contact-message'];
$mail = new PHPMailer(true);
try{
$mail->isSMTP();
$mail->Host = 'qube.teleqom.org';
$mail->SMTPAuth = true;
$mail->Username = 'info@teleqom.org';
$mail->Password = 'RE32uPrias!opijk##';
$mail->SMTPSecure = PHPMailer::ENCRYPTION_STARTTLS;
$mail->Port = 587;
$mail->setFrom('info@teleqom.org', 'Mailer');
$mail->addAddress($receiver_email);
$mail->addReplyTo($_GET['contact-email'], $_GET['contact-name']);
$mail->isHTML(false);
$mail->Subject = 'Contact TeleQom.org';
$mail->Body = $message;
$mail->AltBody = $message;
$mail->send();
header("Location: ".$lang_folder."confirmation.html");
}catch (Exception $e) {
header("Location: ".$lang_folder."err/contact.html");
die();
}
?>