hop email template

This commit is contained in:
tykayn 2020-04-14 18:13:48 +02:00
parent 9b7f2ebd32
commit 81b27811c2
2 changed files with 16 additions and 18 deletions

View File

@ -51,17 +51,12 @@ class DefaultController extends AbstractController {
];
// send email
$this->mail_service->sendOwnerPollsAction();
if ( $this->mail_service->sendOwnerPollsAction( $founduser ) ) {
return $this->json( [
'message' => 'mail succefully sent to user ' . $email,
'data' => '',
],
200 );
} else { // user not found case
return $this->json( [
'message' => 'no user found for email ' . $email,
@ -75,3 +70,6 @@ class DefaultController extends AbstractController {
}
}

View File

@ -98,14 +98,14 @@ class MailService {
'email_template' => 'emails/owner-polls.html.twig',
];
$email = ( new TemplatedEmail( $titleEmail ) )
$email = ( new TemplatedEmail( ) )
->from( 'ne-pas-repondre@framadate-api.cipherbliss.com' )
->to( new Address($admin_user->getEmail() ) )
->subject($titleEmail)
->htmlTemplate($templateVars[ 'email_template' ])
->context( $templateVars);
// send email
return $this->mailer->send( $email );
}
}