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::
214
214
namespace App\MessageSender;
215
215
216
216
use App\Message\ImportantAction;
217
+ use Symfony\Component\Mailer\MailerInterface;
217
218
use Symfony\Component\Messenger\Envelope;
218
219
use Symfony\Component\Messenger\Transport\Sender\SenderInterface;
220
+ use Symfony\Component\Mime\Email;
219
221
220
222
class ImportantActionToEmailSender implements SenderInterface
221
223
{
222
224
private $mailer;
223
225
private $toEmail;
224
226
225
- public function __construct(\Swift_Mailer $mailer, string $toEmail)
227
+ public function __construct(MailerInterface $mailer, string $toEmail)
226
228
{
227
229
$this->mailer = $mailer;
228
230
$this->toEmail = $toEmail;
@@ -237,12 +239,10 @@ you can create your own message sender::
237
239
}
238
240
239
241
$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>')
246
246
);
247
247
248
248
return $envelope;
You can’t perform that action at this time.
0 commit comments