2021-04-21 10:17:02 +02:00
|
|
|
<?php
|
|
|
|
|
2021-04-23 09:17:58 +02:00
|
|
|
if ($_SERVER['REQUEST_METHOD'] != "POST") {
|
|
|
|
die();
|
|
|
|
}
|
|
|
|
|
|
|
|
require_once 'general.php';
|
|
|
|
require_once 'vendor/autoload.php';
|
2021-04-21 10:17:02 +02:00
|
|
|
|
|
|
|
use PHPMailer\PHPMailer\PHPMailer;
|
|
|
|
|
2021-04-23 09:17:58 +02:00
|
|
|
$name = $_POST['name'];
|
|
|
|
$mail = $_POST['mail'];
|
|
|
|
$year = $_POST['year'];
|
|
|
|
$birthday = $_POST['birthday'];
|
|
|
|
$vocation = $_POST['vocation'];
|
|
|
|
$privacy = $_POST['privacy'];
|
|
|
|
|
|
|
|
//validate here
|
|
|
|
|
|
|
|
|
|
|
|
|
2021-04-21 10:17:02 +02:00
|
|
|
$config = getConfig();
|
|
|
|
|
|
|
|
$mail = new PHPMailer(true);
|
|
|
|
|
2021-04-23 09:17:58 +02:00
|
|
|
$mail->isSMTP();
|
|
|
|
$mail->SMTPAuth = true;
|
2021-04-21 10:17:02 +02:00
|
|
|
$mail->Host = $config['mail_server'];
|
|
|
|
$mail->Port = $config['mail_port'];
|
|
|
|
$mail->Username = $config['mail_user'];
|
|
|
|
$mail->Password = $config['mail_password'];
|
|
|
|
|
|
|
|
$mail->From = $config['mail_address'];
|
|
|
|
$mail->FromName = 'Mailer';
|
2021-04-23 09:17:58 +02:00
|
|
|
try {
|
|
|
|
$mail->addAddress('test@joethei.de', 'Joe User');
|
|
|
|
} catch (\PHPMailer\PHPMailer\Exception $e) {
|
|
|
|
}
|
2021-04-21 10:17:02 +02:00
|
|
|
|
|
|
|
$mail->Subject = 'Here is the subject';
|
2021-04-23 09:17:58 +02:00
|
|
|
$mail->AltBody = 'Message without html';
|
2021-04-21 10:17:02 +02:00
|
|
|
$mail->Body = 'This is the HTML message body <b>in bold!</b>';
|
|
|
|
|
|
|
|
|
|
|
|
try {
|
|
|
|
!$mail->send();
|
|
|
|
} catch (\PHPMailer\PHPMailer\Exception $e) {
|
|
|
|
echo $e;
|
|
|
|
}
|