Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Move transactional mails to Mailcoach #320

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,9 @@ MAIL_USERNAME=apikey
MAIL_PASSWORD=
MAIL_ENCRYPTION=tls

MAILCOACH_DOMAIN=
MAILCOACH_API_TOKEN=

PUSHER_APP_ID=
PUSHER_APP_KEY=
PUSHER_APP_SECRET=
Expand Down
2 changes: 1 addition & 1 deletion app/Filament/Resources/Customers/LicenseResource.php
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ public static function table(Table $table): Table
ResourceLinkColumn::make(
'assignment.user.email',
function (License $record) {
if(! $record->assignment) {
if (! $record->assignment) {
return null;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ public static function make()
return ResourceLinkColumn::make(
'assignment.purchasable.title',
function (License $record) {
if(! $record->assignment) {
if (! $record->assignment) {
return null;
}

Expand Down
9 changes: 6 additions & 3 deletions app/Mail/LeakedLicenseKeyRegeneratedMail.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,22 +7,25 @@
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Mail\Mailable;
use Illuminate\Queue\SerializesModels;
use Spatie\MailcoachMailer\Concerns\UsesMailcoachMail;

class LeakedLicenseKeyRegeneratedMail extends Mailable implements ShouldQueue
{
use Queueable;
use SerializesModels;
use UsesMailcoachMail;

public function __construct(
public License $license,
public string $foundOnUrl
) {
}

public function build()
public function build(): void
{
$this
->subject('We have revoked your leaked license key')
->markdown('mails.leakedLicenseKeyRegenerated');
->mailcoachMail('spatie.leaked-license-key', [
'url' => $this->foundOnUrl,
]);
}
}
1 change: 1 addition & 0 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@
"spatie/laravel-health": "^1.18",
"spatie/laravel-help-space": "^1.0",
"spatie/laravel-ignition": "^2.0",
"spatie/laravel-mailcoach-mailer": "*",
"spatie/laravel-markdown": "^2.2.4",
"spatie/laravel-medialibrary": "^11.4.6",
"spatie/laravel-menu": "^4.1",
Expand Down
136 changes: 135 additions & 1 deletion composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions config/mail.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,12 @@
*/

'mailers' => [
'mailcoach' => [
'transport' => 'mailcoach',
'domain' => env('MAILCOACH_DOMAIN'),
'token' => env('MAILCOACH_API_TOKEN'),
],

'smtp' => [
'transport' => 'smtp',
'host' => env('MAIL_HOST', 'smtp.mailgun.org'),
Expand Down
14 changes: 0 additions & 14 deletions resources/views/mails/leakedLicenseKeyRegenerated.blade.php

This file was deleted.