48 lines
1.4 KiB
PHP
48 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;
|
|
|
|
/**
|
|
* "Set a new password."
|
|
*
|
|
* In this product's design rather than the framework's default MailMessage,
|
|
* for the same reason as the verification mail: a customer who has just been
|
|
* locked out is exactly the person a phishing mail is aimed at, and a message
|
|
* that looks nothing like the rest of our post is one they cannot check.
|
|
*
|
|
* It therefore carries the standard footer, which names our domains.
|
|
*/
|
|
class ResetPasswordMail extends Mailable implements ShouldQueue
|
|
{
|
|
use Queueable, SendsFromMailbox, SerializesModels;
|
|
|
|
public function __construct(public User $user, public string $url, public int $minutes)
|
|
{
|
|
$this->mailer('cp_'.MailPurpose::SYSTEM);
|
|
}
|
|
|
|
public function envelope(): Envelope
|
|
{
|
|
return $this->mailboxEnvelope(MailPurpose::SYSTEM, __('reset_password.subject'));
|
|
}
|
|
|
|
public function content(): Content
|
|
{
|
|
return new Content(view: 'mail.reset-password', with: [
|
|
'name' => $this->user->name,
|
|
'url' => $this->url,
|
|
'minutes' => $this->minutes,
|
|
]);
|
|
}
|
|
}
|