update testemail command
This commit is contained in:
parent
b17c09f7a7
commit
b82353d5e2
@ -23,6 +23,7 @@ use Mail;
|
|||||||
use Str;
|
use Str;
|
||||||
|
|
||||||
use function Laravel\Prompts\select;
|
use function Laravel\Prompts\select;
|
||||||
|
use function Laravel\Prompts\text;
|
||||||
|
|
||||||
class TestEmail extends Command
|
class TestEmail extends Command
|
||||||
{
|
{
|
||||||
@ -31,7 +32,7 @@ class TestEmail extends Command
|
|||||||
*
|
*
|
||||||
* @var string
|
* @var string
|
||||||
*/
|
*/
|
||||||
protected $signature = 'email:test {to}';
|
protected $signature = 'email:test';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The console command description.
|
* The console command description.
|
||||||
@ -44,9 +45,10 @@ class TestEmail extends Command
|
|||||||
* Execute the console command.
|
* Execute the console command.
|
||||||
*/
|
*/
|
||||||
private ?MailMessage $mail = null;
|
private ?MailMessage $mail = null;
|
||||||
|
private string $email = 'andras.bacsai@protonmail.com';
|
||||||
public function handle()
|
public function handle()
|
||||||
{
|
{
|
||||||
$email = select(
|
$type = select(
|
||||||
'Which Email should be sent?',
|
'Which Email should be sent?',
|
||||||
options: [
|
options: [
|
||||||
'emails-test' => 'Test',
|
'emails-test' => 'Test',
|
||||||
@ -60,15 +62,15 @@ class TestEmail extends Command
|
|||||||
'waitlist-confirmation' => 'Waitlist Confirmation',
|
'waitlist-confirmation' => 'Waitlist Confirmation',
|
||||||
],
|
],
|
||||||
);
|
);
|
||||||
$type = set_transanctional_email_settings();
|
$this->email = text('Email Address to send to');
|
||||||
if (!$type) {
|
set_transanctional_email_settings();
|
||||||
throw new Exception('No email settings found.');
|
|
||||||
}
|
|
||||||
$this->mail = new MailMessage();
|
$this->mail = new MailMessage();
|
||||||
$this->mail->subject("Test Email");
|
$this->mail->subject("Test Email");
|
||||||
switch ($email) {
|
switch ($type) {
|
||||||
case 'emails-test':
|
case 'emails-test':
|
||||||
$this->mail = (new Test())->toMail();
|
$this->mail = (new Test())->toMail();
|
||||||
|
$this->sendEmail();
|
||||||
break;
|
break;
|
||||||
case 'application-deployment-success':
|
case 'application-deployment-success':
|
||||||
$application = Application::all()->first();
|
$application = Application::all()->first();
|
||||||
@ -176,7 +178,7 @@ class TestEmail extends Command
|
|||||||
'internal@example.com',
|
'internal@example.com',
|
||||||
'Test Email',
|
'Test Email',
|
||||||
)
|
)
|
||||||
->to($this->argument('to') ?? 'test@example.com')
|
->to($this->email)
|
||||||
->subject($this->mail->subject)
|
->subject($this->mail->subject)
|
||||||
->html((string)$this->mail->render())
|
->html((string)$this->mail->render())
|
||||||
);
|
);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user