Skip to content

Commit e28496b

Browse files
authored
Install mailgun driver (#116)
* install mailgun driver * create test email command
1 parent 3a527b4 commit e28496b

File tree

4 files changed

+294
-1
lines changed

4 files changed

+294
-1
lines changed
+23
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
<?php
2+
3+
namespace App\Console\Commands;
4+
5+
use App\Notifications\TestNotification;
6+
use Illuminate\Console\Command;
7+
use Illuminate\Support\Facades\Mail;
8+
use Illuminate\Support\Facades\Notification;
9+
10+
class SendTestEmail extends Command
11+
{
12+
protected $signature = 'app:send-test-email {email}';
13+
14+
protected $description = 'Send a test email via the default mail driver.';
15+
16+
public function handle(): void
17+
{
18+
$this->info('Sending test email via '.Mail::getDefaultDriver().'...');
19+
20+
Notification::route('mail', $this->argument('email'))
21+
->notify(new TestNotification);
22+
}
23+
}
+26
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
<?php
2+
3+
namespace App\Notifications;
4+
5+
use Illuminate\Bus\Queueable;
6+
use Illuminate\Notifications\Messages\MailMessage;
7+
use Illuminate\Notifications\Notification;
8+
9+
class TestNotification extends Notification
10+
{
11+
use Queueable;
12+
13+
public function via(object $notifiable): array
14+
{
15+
return ['mail'];
16+
}
17+
18+
public function toMail(object $notifiable): MailMessage
19+
{
20+
return (new MailMessage)
21+
->subject('Test Notification')
22+
->greeting('It worked!')
23+
->line('This is a test mail notification.')
24+
->action('Go to Website', url(path: '/', secure: true));
25+
}
26+
}

composer.json

+2
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@
1515
"league/commonmark": "^2.4",
1616
"spatie/laravel-menu": "^4.1",
1717
"spatie/yaml-front-matter": "^2.0",
18+
"symfony/http-client": "^7.2",
19+
"symfony/mailgun-mailer": "^7.1",
1820
"torchlight/torchlight-commonmark": "^0.5.5"
1921
},
2022
"require-dev": {

composer.lock

+243-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)