user = $user; $this->recipient = $user->defaultRecipient; $this->token = $user->tokens()->whereDate('expires_at', now()->addWeek())->first(); } /** * Build the message. * * @return $this */ public function build() { return $this ->subject('Your addy.io API key expires soon') ->markdown('mail.token_expiring_soon', [ 'user' => $this->user, 'userId' => $this->user->id, 'recipientId' => $this->user->default_recipient_id, 'emailType' => 'TES', 'fingerprint' => $this->recipient->should_encrypt ? $this->recipient->fingerprint : null, 'tokenName' => $this->token?->name, ]) ->withSymfonyMessage(function (Email $message) { $message->getHeaders() ->addTextHeader('Feedback-ID', 'TES:anonaddy'); }); } }