Archived
1
0
Fork 0

app/controllers/UserController.php: remove usage of SendGrid and use the mail service.

This commit is contained in:
Henrik Hautakoski 2018-09-22 14:03:56 +02:00
parent 9d6e17e646
commit 2929c640f0
No known key found for this signature in database
GPG key ID: 839F3A7EAFAEAFAA

View file

@ -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 <strong>{$user->getEmail()}</strong> with "