
- fix(email): transactional emails are all not sent if `Use system wide (transactional) email settings` is disabled and no other email provide is setup on the Notifications page - fix(email): no emails are sent if SMTP username and SMTP password are empty (which is the case in dev for example) - fix(email): Wrong test email notification is used, causing the transactional email test notification to fail if no email provider is set up on the Notifications page.
41 lines
1.1 KiB
PHP
41 lines
1.1 KiB
PHP
<?php
|
|
|
|
namespace App\Notifications\TransactionalEmails;
|
|
|
|
use App\Models\Team;
|
|
use App\Models\TeamInvitation;
|
|
use App\Models\User;
|
|
use App\Notifications\Channels\TransactionalEmailChannel;
|
|
use App\Notifications\CustomEmailNotification;
|
|
use Illuminate\Notifications\Messages\MailMessage;
|
|
|
|
class InvitationLink extends CustomEmailNotification
|
|
{
|
|
public function via(): array
|
|
{
|
|
return [TransactionalEmailChannel::class];
|
|
}
|
|
|
|
public function __construct(public User $user, public bool $isTransactionalEmail)
|
|
{
|
|
$this->onQueue('high');
|
|
$this->isTransactionalEmail = true;
|
|
}
|
|
|
|
public function toMail(): MailMessage
|
|
{
|
|
$invitation = TeamInvitation::whereEmail($this->user->email)->first();
|
|
$invitation_team = Team::find($invitation->team->id);
|
|
|
|
$mail = new MailMessage;
|
|
$mail->subject('Coolify: Invitation for '.$invitation_team->name);
|
|
$mail->view('emails.invitation-link', [
|
|
'team' => $invitation_team->name,
|
|
'email' => $this->user->email,
|
|
'invitation_link' => $invitation->link,
|
|
]);
|
|
|
|
return $mail;
|
|
}
|
|
}
|