DH_Alumni/submit.php

51 lines
1018 B
PHP

<?php
if ($_SERVER['REQUEST_METHOD'] != "POST") {
die();
}
require_once 'general.php';
require_once 'vendor/autoload.php';
use PHPMailer\PHPMailer\PHPMailer;
$name = $_POST['name'];
$mail = $_POST['mail'];
$year = $_POST['year'];
$birthday = $_POST['birthday'];
$vocation = $_POST['vocation'];
$privacy = $_POST['privacy'];
//validate here
$config = getConfig();
$mail = new PHPMailer(true);
$mail->isSMTP();
$mail->SMTPAuth = true;
$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';
try {
$mail->addAddress('test@joethei.de', 'Joe User');
} catch (\PHPMailer\PHPMailer\Exception $e) {
}
$mail->Subject = 'Here is the subject';
$mail->AltBody = 'Message without html';
$mail->Body = 'This is the HTML message body <b>in bold!</b>';
try {
!$mail->send();
} catch (\PHPMailer\PHPMailer\Exception $e) {
echo $e;
}