internal: trial emails
This commit is contained in:
parent
5d27e89bfa
commit
6266a5e500
@ -7,6 +7,7 @@
|
|||||||
use App\Models\ApplicationPreview;
|
use App\Models\ApplicationPreview;
|
||||||
use App\Models\ScheduledDatabaseBackup;
|
use App\Models\ScheduledDatabaseBackup;
|
||||||
use App\Models\StandalonePostgresql;
|
use App\Models\StandalonePostgresql;
|
||||||
|
use App\Models\Team;
|
||||||
use App\Models\TeamInvitation;
|
use App\Models\TeamInvitation;
|
||||||
use App\Models\User;
|
use App\Models\User;
|
||||||
use App\Models\Waitlist;
|
use App\Models\Waitlist;
|
||||||
@ -62,9 +63,13 @@ public function handle()
|
|||||||
'invitation-link' => 'Invitation Link',
|
'invitation-link' => 'Invitation Link',
|
||||||
'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',
|
||||||
],
|
],
|
||||||
);
|
);
|
||||||
|
$emailsGathered = ['realusers-before-trial'];
|
||||||
|
if (!in_array($type, $emailsGathered)) {
|
||||||
$this->email = text('Email Address to send to');
|
$this->email = text('Email Address to send to');
|
||||||
|
}
|
||||||
set_transanctional_email_settings();
|
set_transanctional_email_settings();
|
||||||
|
|
||||||
$this->mail = new MailMessage();
|
$this->mail = new MailMessage();
|
||||||
@ -159,16 +164,39 @@ public function handle()
|
|||||||
$found = Waitlist::where('email', $this->email)->first();
|
$found = Waitlist::where('email', $this->email)->first();
|
||||||
if ($found) {
|
if ($found) {
|
||||||
SendConfirmationForWaitlistJob::dispatch($this->email, $found->uuid);
|
SendConfirmationForWaitlistJob::dispatch($this->email, $found->uuid);
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
throw new Exception('Waitlist not found');
|
throw new Exception('Waitlist not found');
|
||||||
}
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
case 'realusers-before-trial':
|
||||||
|
$this->mail = new MailMessage();
|
||||||
|
$this->mail->view('emails.before-trial-conversion');
|
||||||
|
$this->mail->subject('Trial period has been added for all subscription plans.');
|
||||||
|
$teams = Team::doesntHave('subscription')->where('id', '!=', 0)->get();
|
||||||
|
if (!$teams || $teams->isEmpty()) {
|
||||||
|
echo 'No teams found.' . PHP_EOL;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
$emails = [];
|
||||||
|
foreach ($teams as $team) {
|
||||||
|
foreach($team->members as $member) {
|
||||||
|
if ($member->email) {
|
||||||
|
$emails[] = $member->email;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
private function sendEmail()
|
}
|
||||||
|
$emails = array_unique($emails);
|
||||||
|
foreach ($emails as $email) {
|
||||||
|
$this->sendEmail($email);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
private function sendEmail(string $email = null)
|
||||||
{
|
{
|
||||||
|
if ($email) {
|
||||||
|
$this->email = $email;
|
||||||
|
}
|
||||||
Mail::send(
|
Mail::send(
|
||||||
[],
|
[],
|
||||||
[],
|
[],
|
||||||
|
8
resources/views/emails/before-trial-conversion.blade.php
Normal file
8
resources/views/emails/before-trial-conversion.blade.php
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
<x-emails.layout>
|
||||||
|
We would like to inform you that a {{config('constants.limits.trial_period')}} days of trial has been added to all subscription plans.
|
||||||
|
|
||||||
|
You can try out Coolify, without payment information for free. If you like it, you can upgrade to a paid plan at any time.
|
||||||
|
|
||||||
|
[Click here](https://app.coolify.io/subscription) to start your trial.
|
||||||
|
</x-emails.layout>
|
||||||
|
|
Loading…
Reference in New Issue
Block a user