better emails
This commit is contained in:
@@ -18,15 +18,15 @@ class DeploymentFailed extends Notification implements ShouldQueue
|
||||
|
||||
public Application $application;
|
||||
public string $deployment_uuid;
|
||||
public ApplicationPreview|null $preview;
|
||||
public ?ApplicationPreview $preview = null;
|
||||
|
||||
public string $application_name;
|
||||
public string|null $deployment_url = null;
|
||||
public ?string $deployment_url = null;
|
||||
public string $project_uuid;
|
||||
public string $environment_name;
|
||||
public string|null $fqdn;
|
||||
public ?string $fqdn = null;
|
||||
|
||||
public function __construct(Application $application, string $deployment_uuid, ApplicationPreview|null $preview)
|
||||
public function __construct(Application $application, string $deployment_uuid, ?ApplicationPreview $preview = null)
|
||||
{
|
||||
$this->application = $application;
|
||||
$this->deployment_uuid = $deployment_uuid;
|
||||
@@ -67,9 +67,8 @@ class DeploymentFailed extends Notification implements ShouldQueue
|
||||
$mail->subject('❌ Deployment failed of ' . $this->application_name . '.');
|
||||
} else {
|
||||
$fqdn = $this->preview->fqdn;
|
||||
$mail->subject('❌ Pull request #' . $this->preview->pull_request_id . ' of ' . $this->application_name . ' deployment failed.');
|
||||
$mail->subject('❌ Deployment failed of pull request #' . $this->preview->pull_request_id . ' of ' . $this->application_name . '.');
|
||||
}
|
||||
|
||||
$mail->view('emails.application-deployment-failed', [
|
||||
'name' => $this->application_name,
|
||||
'fqdn' => $fqdn,
|
||||
|
||||
@@ -20,35 +20,33 @@ class EmailChannel
|
||||
}
|
||||
|
||||
$mailMessage = $notification->toMail($notifiable);
|
||||
if ($this->isResend) {
|
||||
foreach ($recepients as $receipient) {
|
||||
Mail::send(
|
||||
[],
|
||||
[],
|
||||
fn (Message $message) => $message
|
||||
->from(
|
||||
data_get($notifiable, 'smtp_from_address'),
|
||||
data_get($notifiable, 'smtp_from_name'),
|
||||
)
|
||||
->to($receipient)
|
||||
->subject($mailMessage->subject)
|
||||
->html((string)$mailMessage->render())
|
||||
);
|
||||
}
|
||||
} else {
|
||||
Mail::send(
|
||||
[],
|
||||
[],
|
||||
fn (Message $message) => $message
|
||||
->from(
|
||||
data_get($notifiable, 'smtp_from_address'),
|
||||
data_get($notifiable, 'smtp_from_name'),
|
||||
)
|
||||
->bcc($recepients)
|
||||
->subject($mailMessage->subject)
|
||||
->html((string)$mailMessage->render())
|
||||
);
|
||||
}
|
||||
// if ($this->isResend) {
|
||||
Mail::send(
|
||||
[],
|
||||
[],
|
||||
fn (Message $message) => $message
|
||||
->from(
|
||||
data_get($notifiable, 'smtp_from_address'),
|
||||
data_get($notifiable, 'smtp_from_name'),
|
||||
)
|
||||
->to($recepients)
|
||||
->subject($mailMessage->subject)
|
||||
->html((string)$mailMessage->render())
|
||||
);
|
||||
// } else {
|
||||
// Mail::send(
|
||||
// [],
|
||||
// [],
|
||||
// fn (Message $message) => $message
|
||||
// ->from(
|
||||
// data_get($notifiable, 'smtp_from_address'),
|
||||
// data_get($notifiable, 'smtp_from_name'),
|
||||
// )
|
||||
// ->bcc($recepients)
|
||||
// ->subject($mailMessage->subject)
|
||||
// ->html((string)$mailMessage->render())
|
||||
// );
|
||||
// }
|
||||
}
|
||||
|
||||
private function bootConfigs($notifiable): void
|
||||
|
||||
@@ -26,33 +26,33 @@ class TransactionalEmailChannel
|
||||
}
|
||||
$this->bootConfigs();
|
||||
$mailMessage = $notification->toMail($notifiable);
|
||||
if ($this->isResend) {
|
||||
Mail::send(
|
||||
[],
|
||||
[],
|
||||
fn (Message $message) => $message
|
||||
->from(
|
||||
data_get($settings, 'smtp_from_address'),
|
||||
data_get($settings, 'smtp_from_name'),
|
||||
)
|
||||
->to($email)
|
||||
->subject($mailMessage->subject)
|
||||
->html((string)$mailMessage->render())
|
||||
);
|
||||
} else {
|
||||
Mail::send(
|
||||
[],
|
||||
[],
|
||||
fn (Message $message) => $message
|
||||
->from(
|
||||
data_get($settings, 'smtp_from_address'),
|
||||
data_get($settings, 'smtp_from_name'),
|
||||
)
|
||||
->bcc($email)
|
||||
->subject($mailMessage->subject)
|
||||
->html((string)$mailMessage->render())
|
||||
);
|
||||
}
|
||||
// if ($this->isResend) {
|
||||
Mail::send(
|
||||
[],
|
||||
[],
|
||||
fn (Message $message) => $message
|
||||
->from(
|
||||
data_get($settings, 'smtp_from_address'),
|
||||
data_get($settings, 'smtp_from_name'),
|
||||
)
|
||||
->to($email)
|
||||
->subject($mailMessage->subject)
|
||||
->html((string)$mailMessage->render())
|
||||
);
|
||||
// } else {
|
||||
// Mail::send(
|
||||
// [],
|
||||
// [],
|
||||
// fn (Message $message) => $message
|
||||
// ->from(
|
||||
// data_get($settings, 'smtp_from_address'),
|
||||
// data_get($settings, 'smtp_from_name'),
|
||||
// )
|
||||
// ->bcc($email)
|
||||
// ->subject($mailMessage->subject)
|
||||
// ->html((string)$mailMessage->render())
|
||||
// );
|
||||
// }
|
||||
}
|
||||
|
||||
private function bootConfigs(): void
|
||||
|
||||
@@ -14,12 +14,13 @@ class BackupFailed extends Notification implements ShouldQueue
|
||||
{
|
||||
use Queueable;
|
||||
|
||||
public string $message = 'Backup FAILED';
|
||||
|
||||
public string $name;
|
||||
public string $frequency;
|
||||
|
||||
public function __construct(ScheduledDatabaseBackup $backup, public $database, public $output)
|
||||
{
|
||||
$this->message = "❌ Database backup for {$database->name} with frequency of $backup->frequency was FAILED.\n\nReason: $output";
|
||||
$this->name = $database->name;
|
||||
$this->frequency = $backup->frequency;
|
||||
}
|
||||
|
||||
public function via(object $notifiable): array
|
||||
@@ -36,20 +37,23 @@ class BackupFailed extends Notification implements ShouldQueue
|
||||
if ($isDiscordEnabled && $isSubscribedToDiscordEvent) {
|
||||
$channels[] = DiscordChannel::class;
|
||||
}
|
||||
ray($channels);
|
||||
return $channels;
|
||||
}
|
||||
|
||||
public function toMail(): MailMessage
|
||||
{
|
||||
$mail = new MailMessage();
|
||||
$mail->subject("❌ Backup FAILED for {$this->database->name}");
|
||||
$mail->line($this->message);
|
||||
$mail->subject("❌ [ACTION REQUIRED] Backup FAILED for {$this->database->name}");
|
||||
$mail->view('emails.backup-failed', [
|
||||
'name' => $this->name,
|
||||
'frequency' => $this->frequency,
|
||||
'output' => $this->output,
|
||||
]);
|
||||
return $mail;
|
||||
}
|
||||
|
||||
public function toDiscord(): string
|
||||
{
|
||||
return $this->message;
|
||||
return "❌ Database backup for {$this->name} with frequency of {$this->frequency} was FAILED.\n\nReason: {$this->output}";
|
||||
}
|
||||
}
|
||||
|
||||
@@ -14,12 +14,13 @@ class BackupSuccess extends Notification implements ShouldQueue
|
||||
{
|
||||
use Queueable;
|
||||
|
||||
public string $message = 'Backup Success';
|
||||
|
||||
public string $name;
|
||||
public string $frequency;
|
||||
|
||||
public function __construct(ScheduledDatabaseBackup $backup, public $database)
|
||||
{
|
||||
$this->message = "✅ Database backup for {$database->name} with frequency of $backup->frequency was successful.";
|
||||
$this->name = $database->name;
|
||||
$this->frequency = $backup->frequency;
|
||||
}
|
||||
|
||||
public function via(object $notifiable): array
|
||||
@@ -42,13 +43,16 @@ class BackupSuccess extends Notification implements ShouldQueue
|
||||
public function toMail(): MailMessage
|
||||
{
|
||||
$mail = new MailMessage();
|
||||
$mail->subject("✅ Backup success for {$this->database->name}");
|
||||
$mail->line($this->message);
|
||||
$mail->subject("✅ Backup successfully done for {$this->database->name}");
|
||||
$mail->view('emails.backup-success', [
|
||||
'name' => $this->name,
|
||||
'frequency' => $this->frequency,
|
||||
]);
|
||||
return $mail;
|
||||
}
|
||||
|
||||
public function toDiscord(): string
|
||||
{
|
||||
return $this->message;
|
||||
return "✅ Database backup for {$this->name} with frequency of {$this->frequency} was successful.";
|
||||
}
|
||||
}
|
||||
|
||||
@@ -36,7 +36,7 @@ class Test extends Notification implements ShouldQueue
|
||||
public function toMail(): MailMessage
|
||||
{
|
||||
$mail = new MailMessage();
|
||||
$mail->subject("Coolify Test Notification");
|
||||
$mail->subject("Test Email");
|
||||
$mail->view('emails.test');
|
||||
return $mail;
|
||||
}
|
||||
|
||||
@@ -20,16 +20,19 @@ class InvitationLink extends Notification implements ShouldQueue
|
||||
return [TransactionalEmailChannel::class];
|
||||
}
|
||||
|
||||
public function toMail(User $user): MailMessage
|
||||
public function __construct(public User $user)
|
||||
{
|
||||
$invitation = TeamInvitation::whereEmail($user->email)->first();
|
||||
}
|
||||
public function toMail(): MailMessage
|
||||
{
|
||||
$invitation = TeamInvitation::whereEmail($this->user->email)->first();
|
||||
$invitation_team = Team::find($invitation->team->id);
|
||||
|
||||
$mail = new MailMessage();
|
||||
$mail->subject('Invitation for ' . $invitation_team->name);
|
||||
$mail->view('emails.invitation-link', [
|
||||
'team' => $invitation_team->name,
|
||||
'email' => $user->email,
|
||||
'email' => $this->user->email,
|
||||
'invitation_link' => $invitation->link,
|
||||
]);
|
||||
return $mail;
|
||||
|
||||
@@ -24,7 +24,7 @@ class Test extends Notification implements ShouldQueue
|
||||
public function toMail(): MailMessage
|
||||
{
|
||||
$mail = new MailMessage();
|
||||
$mail->subject('Test Notification');
|
||||
$mail->subject('Test Email');
|
||||
$mail->view('emails.test');
|
||||
return $mail;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user