#124: E-mails now send and log to the database as sent when queuing is not enabled
This commit is contained in:
parent
7418438d63
commit
216c93a750
@ -17,7 +17,7 @@ class QueueEmailDatabaseChannel extends EmailDatabaseWriterChannelBase
|
|||||||
public function send($notifiable, Notification $notification)
|
public function send($notifiable, Notification $notification)
|
||||||
{
|
{
|
||||||
/** @var EmailLog $logEntry */
|
/** @var EmailLog $logEntry */
|
||||||
$logEntry = $notification->toQueueEmailDatabase($notifiable);
|
$logEntry = $notification->toEmailDatabase($notifiable);
|
||||||
|
|
||||||
$this->writeToTable($logEntry, true);
|
$this->writeToTable($logEntry, true);
|
||||||
}
|
}
|
||||||
|
@ -6,10 +6,7 @@ use App\Facade\UserConfig;
|
|||||||
use App\Mail\MailableBase;
|
use App\Mail\MailableBase;
|
||||||
use App\Mail\ResetMyPassword;
|
use App\Mail\ResetMyPassword;
|
||||||
use Illuminate\Bus\Queueable;
|
use Illuminate\Bus\Queueable;
|
||||||
use Illuminate\Mail\Mailable;
|
|
||||||
use Illuminate\Notifications\Notification;
|
use Illuminate\Notifications\Notification;
|
||||||
use Illuminate\Contracts\Queue\ShouldQueue;
|
|
||||||
use Illuminate\Notifications\Messages\MailMessage;
|
|
||||||
|
|
||||||
class ResetPassword extends Notification
|
class ResetPassword extends Notification
|
||||||
{
|
{
|
||||||
@ -56,7 +53,7 @@ class ResetPassword extends Notification
|
|||||||
return $drivers;
|
return $drivers;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function toQueueEmailDatabase($notifiable)
|
public function toEmailDatabase($notifiable)
|
||||||
{
|
{
|
||||||
return $this->toMail($notifiable)->buildEmailLog();
|
return $this->toMail($notifiable)->buildEmailLog();
|
||||||
}
|
}
|
||||||
|
@ -17,7 +17,7 @@ class SentEmailDatabaseChannel extends EmailDatabaseWriterChannelBase
|
|||||||
public function send($notifiable, Notification $notification)
|
public function send($notifiable, Notification $notification)
|
||||||
{
|
{
|
||||||
/** @var EmailLog $logEntry */
|
/** @var EmailLog $logEntry */
|
||||||
$logEntry = $notification->toDatabaseWriter($notifiable);
|
$logEntry = $notification->toEmailDatabase($notifiable);
|
||||||
|
|
||||||
$this->writeToTable($logEntry, false);
|
$this->writeToTable($logEntry, false);
|
||||||
}
|
}
|
||||||
|
13
resources/systemd/blue-twilight-email.service
Normal file
13
resources/systemd/blue-twilight-email.service
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
[Unit]
|
||||||
|
Description=Blue Twilight E-mail Queue Runner
|
||||||
|
|
||||||
|
[Service]
|
||||||
|
WorkingDirectory=/data/www/blue-twilight.andysh.dev/
|
||||||
|
ExecStart=/usr/bin/php artisan bt-queue:send-emails --poll
|
||||||
|
Restart=on-failure
|
||||||
|
User=www-data
|
||||||
|
Group=www-data
|
||||||
|
Environment=USER=www-data HOME=/var/www
|
||||||
|
|
||||||
|
[Install]
|
||||||
|
WantedBy=multi-user.target
|
Loading…
Reference in New Issue
Block a user