Skip to content

An open-source, self-hostable PaaS alternative to Vercel, Heroku & Netlify that lets you easily deploy static sites, databases, full-stack applications and 360+ one-click services on your own servers.

wip

Joao Patricioaea6bced69c0
diff --git a/app/Http/Livewire/Settings/DiscordNotifications.php b/app/Http/Livewire/Settings/DiscordNotifications.php
index 01388a2389..4227c22765 100644
--- a/app/Http/Livewire/Settings/DiscordNotifications.php
+++ b/app/Http/Livewire/Settings/DiscordNotifications.php
@@ -29,7 +29,7 @@ class DiscordNotifications extends Component
}
public function sentTestMessage()
{
- // @TODO figure out how to do it in runtime
+ Notification::send(auth()->user(), new TestMessage);
}
public function render()
{
diff --git a/app/Http/Livewire/Settings/EmailNotifications.php b/app/Http/Livewire/Settings/EmailNotifications.php
index 639fb11cda..b1bca81c88 100644
--- a/app/Http/Livewire/Settings/EmailNotifications.php
+++ b/app/Http/Livewire/Settings/EmailNotifications.php
@@ -40,7 +40,7 @@ class EmailNotifications extends Component
}
public function sentTestMessage()
{
- Notification::send(auth()->user(), new TestMessage);
+
}
public function render()
{
diff --git a/app/Mail/ExampleMail.php b/app/Mail/ExampleMail.php
new file mode 100644
index 0000000000..0167b26e1f
--- /dev/null
+++ b/app/Mail/ExampleMail.php
@@ -0,0 +1,53 @@
+<?php
+
+namespace App\Mail;
+
+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;
+
+class ExampleMail extends Mailable
+{
+ use Queueable, SerializesModels;
+
+ /**
+ * Create a new message instance.
+ */
+ public function __construct()
+ {
+ //
+ }
+
+ /**
+ * Get the message envelope.
+ */
+ public function envelope(): Envelope
+ {
+ return new Envelope(
+ subject: 'Example Mail',
+ );
+ }
+
+ /**
+ * Get the message content definition.
+ */
+ public function content(): Content
+ {
+ return new Content(
+ view: 'emails.example',
+ );
+ }
+
+ /**
+ * Get the attachments for the message.
+ *
+ * @return array<int, \Illuminate\Mail\Mailables\Attachment>
+ */
+ public function attachments(): array
+ {
+ return [];
+ }
+}
diff --git a/app/Notifications/TestMessage.php b/app/Notifications/TestMessage.php
index 8e8929f100..717f6ce08d 100644
--- a/app/Notifications/TestMessage.php
+++ b/app/Notifications/TestMessage.php
@@ -35,6 +35,24 @@ class TestMessage extends Notification
*/
public function toMail(object $notifiable): MailMessage
{
+ $smtp = [
+ "transport" => "smtp",
+ "host" => "mailpit",
+ "port" => 1025,
+ "encryption" => 'tls',
+ "username" => null,
+ "password" => null,
+ "timeout" => null,
+ "local_domain" => null,
+ ];
+ config()->set('mail.mailers.smtp', $smtp);
+
+ \Illuminate\Support\Facades\Mail::mailer('smtp')
+ ->send(new \App\Mail\ExampleMail);
+
+
+
return (new MailMessage)
->line('Welcome to Coolify!')
->action('Go to dashboard', url('/'))
@@ -43,6 +61,7 @@ class TestMessage extends Notification
public function toDiscord(object $notifiable): string
{
+ ray('1111');
return 'Welcome to Coolify! We need your attention for disk usage. [Go to dashboard]('.url('/').')';
}
diff --git a/docker-compose.dev.yml b/docker-compose.dev.yml
index 76065370cf..4a9b3c0f91 100644
--- a/docker-compose.dev.yml
+++ b/docker-compose.dev.yml
@@ -21,8 +21,6 @@ services:
SSL_MODE: "off"
AUTORUN_LARAVEL_STORAGE_LINK: "false"
AUTORUN_LARAVEL_MIGRATION: "false"
- env_file:
- - .env
volumes:
- .:/var/www/html/:cached
postgres:
diff --git a/resources/views/emails/example.blade.php b/resources/views/emails/example.blade.php
new file mode 100644
index 0000000000..bbfbe24b1e
--- /dev/null
+++ b/resources/views/emails/example.blade.php
@@ -0,0 +1 @@
+Hello I am an example
diff --git a/resources/views/livewire/settings/email-notifications.blade.php b/resources/views/livewire/settings/email-notifications.blade.php
index 6bfc535062..4f3af41568 100644
--- a/resources/views/livewire/settings/email-notifications.blade.php
+++ b/resources/views/livewire/settings/email-notifications.blade.php
@@ -12,10 +12,13 @@
<x-inputs.input id="settings.extra_attributes.smtp_timeout" label="Timeout" />
</div>
</div>
- <div>
+ <div class="flex">
<x-inputs.button class="w-16 mt-4" type="submit">
Submit
</x-inputs.button>
+ </div>
+ <div class="mt-10 flex flex-col w-96">
+ <x-inputs.input id="settings.extra_attributes.smtp_username" label="Send a test e-mail to:" />
<x-inputs.button class="mt-4 btn btn-xs no-animation normal-case text-white btn-primary" wire:click="sentTestMessage">
Send test message
</x-inputs.button>
diff --git a/resources/views/settings.blade.php b/resources/views/settings.blade.php
index f0155603d0..dbd8588f10 100644
--- a/resources/views/settings.blade.php
+++ b/resources/views/settings.blade.php
@@ -4,9 +4,11 @@
<h3>General</h3>
<livewire:settings.form :settings="$settings" />
- <div class="my-12"></div>
+ <div class="h-12"></div>
<h3>Notifications</h3>
<livewire:settings.discord-notifications :settings="$settings" />
<livewire:settings.email-notifications :settings="$settings" />
+
+ <div class="h-12"></div>
</x-layout>
diff --git a/routes/console.php b/routes/console.php
index 34f661adbd..2de1715bec 100644
--- a/routes/console.php
+++ b/routes/console.php
@@ -1,6 +1,7 @@
<?php
use Illuminate\Foundation\Inspiring;
+use Illuminate\Notifications\Messages\MailMessage;
use Illuminate\Support\Facades\Artisan;
use Symfony\Component\Mailer\Mailer;
@@ -29,13 +30,15 @@ Artisan::command('inspire', function () {
];
config()->set('mail.mailers.smtp', $smtp);
-// \Illuminate\Support\Facades\Mail::mailer('smtp')
-// ->to('[email protected]')
-// ->send(new \App\Mail\TestMail);
+ // For testing custom SMTP Mailer
+ \Illuminate\Support\Facades\Mail::mailer('smtp')
+ ->send(new \App\Mail\ExampleMail);
- \Illuminate\Support\Facades\Notification::send(
- \App\Models\User::find(1),
- new \App\Notifications\TestMessage
- );
+ // For sending a notification
+// \Illuminate\Support\Facades\Notification::send(
+// \App\Models\User::find(1),
+// new \App\Notifications\TestMessage
+// );
})->purpose('Display an inspiring quote');