File tree Expand file tree Collapse file tree 1 file changed +7
-7
lines changed Expand file tree Collapse file tree 1 file changed +7
-7
lines changed Original file line number Diff line number Diff line change @@ -214,15 +214,17 @@ you can create your own message sender::
214214 namespace App\MessageSender;
215215
216216 use App\Message\ImportantAction;
217+ use Symfony\Component\Mailer\MailerInterface;
217218 use Symfony\Component\Messenger\Envelope;
218219 use Symfony\Component\Messenger\Transport\Sender\SenderInterface;
220+ use Symfony\Component\Mime\Email;
219221
220222 class ImportantActionToEmailSender implements SenderInterface
221223 {
222224 private $mailer;
223225 private $toEmail;
224226
225- public function __construct(\Swift_Mailer $mailer, string $toEmail)
227+ public function __construct(MailerInterface $mailer, string $toEmail)
226228 {
227229 $this->mailer = $mailer;
228230 $this->toEmail = $toEmail;
@@ -237,12 +239,10 @@ you can create your own message sender::
237239 }
238240
239241 $this->mailer->send(
240- (new \Swift_Message('Important action made'))
241- ->setTo($this->toEmail)
242- ->setBody(
243- '<h1>Important action</h1><p>Made by '.$message->getUsername().'</p>',
244- 'text/html'
245- )
242+ (new Email())
243+ ->to($this->toEmail)
244+ ->subject('Important action made')
245+ ->html('<h1>Important action</h1><p>Made by '.$message->getUsername().'</p>')
246246 );
247247
248248 return $envelope;
You can’t perform that action at this time.
0 commit comments