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");