diff --git a/app/controllers/UserController.php b/app/controllers/UserController.php index 4e6c7de..8faef57 100644 --- a/app/controllers/UserController.php +++ b/app/controllers/UserController.php @@ -5,7 +5,8 @@ namespace App\Controller; use App\Controller\ControllerBase, App\Form\UserSettings as UserSettingsForm, App\Model\Data\ActivityLog, - App\Model\Data\PasswordLink; + App\Model\Data\PasswordLink, + SendGrid\Mail\Mail as SendGridMail; class UserController extends ControllerBase { @@ -36,7 +37,19 @@ class UserController extends ControllerBase ->setPassword($hash) ->save(); - // TODO: Send the email here. + $tpl = $this->di->get('template'); + $body = $tpl->render('mail/password_activation', [ + 'link' => $link->getPublicId() + ]); + + $mail = new SendGridMail(); + $mail->setFrom('noreply@shufflingpixels.com'); + $mail->setSubject('Httpcb password activation'); + $mail->addTo($user->getEmail()); + $mail->addContent('text/html', $body); + + $sendgrid = $this->di->get('sendgrid'); + $sendgrid->send($mail); $msg = "For security reasons. Before a password can be created " . "a email has been sent to {$user->getEmail()} with "