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:
committed by
Daniël Klabbers
parent
857fd95b5e
commit
03a4997a1c
36
src/Mail/Job/SendRawEmailJob.php
Normal file
36
src/Mail/Job/SendRawEmailJob.php
Normal 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);
|
||||
});
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user