1
0
mirror of https://github.com/flarum/core.git synced 2025-08-08 01:16:52 +02:00

Send emails through the queue

This commit is contained in:
Alexander Skvortsov
2020-03-28 18:52:00 -04:00
committed by Daniël Klabbers
parent 857fd95b5e
commit 03a4997a1c
5 changed files with 71 additions and 43 deletions

View File

@@ -0,0 +1,36 @@
<?php
/*
* This file is part of Flarum.
*
* For detailed copyright and license information, please view the
* LICENSE file that was distributed with this source code.
*/
namespace Flarum\Mail\Job;
use Flarum\Queue\AbstractJob;
use Illuminate\Contracts\Mail\Mailer;
use Illuminate\Mail\Message;
class SendRawEmailJob extends AbstractJob
{
private $email;
private $subject;
private $body;
public function __construct(string $email, string $subject, string $body)
{
$this->email = $email;
$this->subject = $subject;
$this->body = $body;
}
public function handle(Mailer $mailer)
{
$mailer->raw($this->body, function (Message $message) {
$message->to($this->email);
$message->subject($this->subject);
});
}
}