whisper-money/app/Mail/EnableBankingConnectionsCan...

64 lines
1.6 KiB
PHP

<?php
namespace App\Mail;
use App\Models\User;
use Illuminate\Bus\Queueable;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Mail\Mailable;
use Illuminate\Mail\Mailables\Address;
use Illuminate\Mail\Mailables\Content;
use Illuminate\Mail\Mailables\Envelope;
use Illuminate\Queue\Middleware\RateLimited;
use Illuminate\Queue\SerializesModels;
class EnableBankingConnectionsCancelledEmail extends Mailable implements ShouldQueue
{
use Queueable, SerializesModels;
/** @var int */
public $tries = 5;
/** @var array<int, int> */
public $backoff = [2, 5, 10, 30];
public function __construct(
public User $user,
public int $removedConnectionsCount,
) {
$this->onQueue('emails');
}
public function envelope(): Envelope
{
return new Envelope(
from: new Address(
config('mail.from.address', 'no-reply@whisper.money'),
config('mail.from.name', 'Whisper Money'),
),
subject: __('Your bank connections were disconnected'),
);
}
public function content(): Content
{
return new Content(
markdown: 'mail.enable-banking-connections-cancelled',
with: [
'userName' => $this->user->name,
'removedConnectionsCount' => $this->removedConnectionsCount,
],
);
}
/**
* Get the middleware the job should pass through.
*
* @return array<int, object>
*/
public function middleware(): array
{
return [(new RateLimited('emails'))->releaseAfter(1)];
}
}