49 lines
1.4 KiB
PHP
49 lines
1.4 KiB
PHP
<?php
|
|
|
|
namespace App\Mail;
|
|
|
|
use App\Mail\Concerns\SendsFromMailbox;
|
|
use App\Models\User;
|
|
use App\Services\Mail\MailPurpose;
|
|
use Illuminate\Bus\Queueable;
|
|
use Illuminate\Contracts\Queue\ShouldQueue;
|
|
use Illuminate\Mail\Mailable;
|
|
use Illuminate\Mail\Mailables\Content;
|
|
use Illuminate\Mail\Mailables\Envelope;
|
|
use Illuminate\Queue\SerializesModels;
|
|
|
|
/**
|
|
* "Your account will be removed in a fortnight, and here is how to keep it."
|
|
*
|
|
* Sent once, a fortnight before an account that has never had a package is
|
|
* deleted for good (App\Console\Commands\PruneDormantAccounts). Not a marketing
|
|
* mail and not a nudge to buy something: it says what will happen, when, and that
|
|
* signing in is enough to stop it.
|
|
*
|
|
* From the SYSTEM mailbox — this is about the login, not about money and not
|
|
* about a running service.
|
|
*/
|
|
class DormantAccountWarningMail extends Mailable implements ShouldQueue
|
|
{
|
|
use Queueable, SendsFromMailbox, SerializesModels;
|
|
|
|
public function __construct(public User $user, public int $days)
|
|
{
|
|
$this->mailer('cp_'.MailPurpose::SYSTEM);
|
|
}
|
|
|
|
public function envelope(): Envelope
|
|
{
|
|
return $this->mailboxEnvelope(MailPurpose::SYSTEM, __('dormant_mail.subject'));
|
|
}
|
|
|
|
public function content(): Content
|
|
{
|
|
return new Content(view: 'mail.dormant-warning', with: [
|
|
'name' => (string) $this->user->name,
|
|
'days' => $this->days,
|
|
'loginUrl' => route('login'),
|
|
]);
|
|
}
|
|
}
|