From fd44dd9a93b3e2debf49ae8369bd93ea1e821b30 Mon Sep 17 00:00:00 2001 From: Skylar Ittner Date: Sun, 9 Dec 2018 20:22:41 -0700 Subject: [PATCH] Add email verification code sending (close #3) --- public/parts/verify.php | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/public/parts/verify.php b/public/parts/verify.php index 4c1f840..64744f0 100644 --- a/public/parts/verify.php +++ b/public/parts/verify.php @@ -20,8 +20,17 @@ if (!empty($_POST['email'])) { $_SESSION['code'] = $code; $_SESSION['maybefamily'] = $database->get('families', 'familyid', ['email' => strtolower($_POST['email'])]); - // TODO: send email - file_put_contents("/var/www/html/code.txt", $code); + try { + $verification = new Email(); + $verification->addTo(NOTIFICATION_TO); + $verification->setFrom(SMTP_FROMADDRESS, SMTP_FROMNAME); + $verification->setSMTP(SMTP_HOST, SMTP_PORT, SMTP_AUTH, SMTP_USERNAME, SMTP_PASSWORD, SMTP_SECURITY); + $verification->setSubject("HACHE email verification"); + $verification->setBody("The verification code for renewing your HACHE membership is $code."); + $verification->send(); + } catch (Exception $e) { + + } } else if (!empty($_POST['code'])) { if (empty($_SESSION['code'])) { header("Location: ./?page=renew&msg=sessionexpired");