diff --git a/app/controllers/UserController.php b/app/controllers/UserController.php index 09bab32..0d03705 100644 --- a/app/controllers/UserController.php +++ b/app/controllers/UserController.php @@ -6,8 +6,7 @@ use App\Controller\ControllerBase, App\Form\UserSettings as UserSettingsForm, App\Model\Data\ActivityLog, App\Model\Data\PasswordLink, - App\Model\Data\User, - SendGrid\Mail\Mail as SendGridMail; + App\Model\Data\User; class UserController extends ControllerBase { @@ -45,19 +44,15 @@ class UserController extends ControllerBase ->setPassword($hash) ->save(); + // Render the email content. $tpl = $this->di->get('template'); - $body = $tpl->render('mail/password_activation', [ + $content = $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); + // Send the email. + $this->di->getMail()->send('Httpcb password activation', + $user->getEmail(), $content); $msg = "For security reasons. Before a password can be created " . "a email has been sent to {$user->getEmail()} with "