email: server lost connection
This commit is contained in:
		@@ -6,6 +6,7 @@ use App\Jobs\SendConfirmationForWaitlistJob;
 | 
				
			|||||||
use App\Models\Application;
 | 
					use App\Models\Application;
 | 
				
			||||||
use App\Models\ApplicationPreview;
 | 
					use App\Models\ApplicationPreview;
 | 
				
			||||||
use App\Models\ScheduledDatabaseBackup;
 | 
					use App\Models\ScheduledDatabaseBackup;
 | 
				
			||||||
 | 
					use App\Models\Server;
 | 
				
			||||||
use App\Models\StandalonePostgresql;
 | 
					use App\Models\StandalonePostgresql;
 | 
				
			||||||
use App\Models\Team;
 | 
					use App\Models\Team;
 | 
				
			||||||
use App\Models\TeamInvitation;
 | 
					use App\Models\TeamInvitation;
 | 
				
			||||||
@@ -65,9 +66,10 @@ class Emails extends Command
 | 
				
			|||||||
                'waitlist-invitation-link' => 'Waitlist Invitation Link',
 | 
					                'waitlist-invitation-link' => 'Waitlist Invitation Link',
 | 
				
			||||||
                'waitlist-confirmation' => 'Waitlist Confirmation',
 | 
					                'waitlist-confirmation' => 'Waitlist Confirmation',
 | 
				
			||||||
                'realusers-before-trial' => 'REAL - Registered Users Before Trial without Subscription',
 | 
					                'realusers-before-trial' => 'REAL - Registered Users Before Trial without Subscription',
 | 
				
			||||||
 | 
					                'realusers-server-lost-connection' => 'REAL - Server Lost Connection',
 | 
				
			||||||
            ],
 | 
					            ],
 | 
				
			||||||
        );
 | 
					        );
 | 
				
			||||||
        $emailsGathered = ['realusers-before-trial'];
 | 
					        $emailsGathered = ['realusers-before-trial','realusers-server-lost-connection'];
 | 
				
			||||||
        if (!in_array($type, $emailsGathered)) {
 | 
					        if (!in_array($type, $emailsGathered)) {
 | 
				
			||||||
            $this->email = text('Email Address to send to');
 | 
					            $this->email = text('Email Address to send to');
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
@@ -199,6 +201,32 @@ class Emails extends Command
 | 
				
			|||||||
                    }
 | 
					                    }
 | 
				
			||||||
                }
 | 
					                }
 | 
				
			||||||
                break;
 | 
					                break;
 | 
				
			||||||
 | 
					            case 'realusers-server-lost-connection':
 | 
				
			||||||
 | 
					                $serverId = text('Server Id');
 | 
				
			||||||
 | 
					                $server = Server::find($serverId);
 | 
				
			||||||
 | 
					                if (!$server) {
 | 
				
			||||||
 | 
					                    throw new Exception('Server not found');
 | 
				
			||||||
 | 
					                }
 | 
				
			||||||
 | 
					                $admins = [];
 | 
				
			||||||
 | 
					                $members = $server->team->members;
 | 
				
			||||||
 | 
					                foreach ($members as $member) {
 | 
				
			||||||
 | 
					                    if ($member->isAdmin()) {
 | 
				
			||||||
 | 
					                        $admins[] = $member->email;
 | 
				
			||||||
 | 
					                    }
 | 
				
			||||||
 | 
					                }
 | 
				
			||||||
 | 
					                $this->info('Sending to ' . count($admins) . ' admins.');
 | 
				
			||||||
 | 
					                foreach ($admins as $admin) {
 | 
				
			||||||
 | 
					                    $this->info($admin);
 | 
				
			||||||
 | 
					                }
 | 
				
			||||||
 | 
					                $this->mail = new MailMessage();
 | 
				
			||||||
 | 
					                $this->mail->view('emails.server-lost-connection', [
 | 
				
			||||||
 | 
					                    'name' => $server->name,
 | 
				
			||||||
 | 
					                ]);
 | 
				
			||||||
 | 
					                $this->mail->subject('Action required: Server ' . $server->name . ' lost connection.');
 | 
				
			||||||
 | 
					                foreach ($admins as $email) {
 | 
				
			||||||
 | 
					                    $this->sendEmail($email);
 | 
				
			||||||
 | 
					                }
 | 
				
			||||||
 | 
					                break;
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
    private function sendEmail(string $email = null)
 | 
					    private function sendEmail(string $email = null)
 | 
				
			||||||
 
 | 
				
			|||||||
							
								
								
									
										7
									
								
								resources/views/emails/server-lost-connection.blade.php
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										7
									
								
								resources/views/emails/server-lost-connection.blade.php
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,7 @@
 | 
				
			|||||||
 | 
					<x-emails.layout>
 | 
				
			||||||
 | 
					Coolify Cloud cannot connect to your server ({{$name}}). Please check your server and make sure it is running.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					If you have any questions, please contact us.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					</x-emails.layout>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		Reference in New Issue
	
	Block a user