Updates for mailing logic
This commit is contained in:
parent
7db1402cb4
commit
ce599d5787
|
|
@ -346,18 +346,13 @@ class NinjaMailerJob implements ShouldQueue
|
|||
$t = app('translator');
|
||||
$t->replace(Ninja::transformTranslations($this->nmo->settings));
|
||||
|
||||
if(Ninja::isHosted() && $this->nmo?->transport == 'default') {
|
||||
$this->mailer = config('mail.default');
|
||||
return $this;
|
||||
}
|
||||
|
||||
/** Force free/trials onto specific mail driver */
|
||||
if ($this->nmo->settings->email_sending_method == 'default' && $this->company->account->isNewHostedAccount()) {
|
||||
if(Ninja::isHosted() && $this->nmo?->transport == 'default' && ($this->company->account->isNewHostedAccount() || !$this->company->account->isPaid())) {
|
||||
$this->mailer = 'mailgun';
|
||||
$this->setHostedMailgunMailer();
|
||||
return $this;
|
||||
}
|
||||
|
||||
|
||||
if (Ninja::isHosted() && $this->company->account->isPaid() && $this->nmo->settings->email_sending_method == 'default') {
|
||||
//check if outlook.
|
||||
|
||||
|
|
@ -399,10 +394,6 @@ class NinjaMailerJob implements ShouldQueue
|
|||
$this->mailer = 'mailgun';
|
||||
$this->setHostedMailgunMailer();
|
||||
return $this;
|
||||
case 'ses':
|
||||
$this->mailer = 'ses';
|
||||
$this->setHostedSesMailer();
|
||||
return $this;
|
||||
case 'gmail':
|
||||
$this->mailer = 'gmail';
|
||||
$this->setGmailMailer();
|
||||
|
|
@ -584,20 +575,6 @@ class NinjaMailerJob implements ShouldQueue
|
|||
|
||||
}
|
||||
|
||||
private function setHostedSesMailer()
|
||||
{
|
||||
|
||||
if (property_exists($this->nmo->settings, 'email_from_name') && strlen($this->nmo->settings->email_from_name) > 1) {
|
||||
$email_from_name = $this->nmo->settings->email_from_name;
|
||||
} else {
|
||||
$email_from_name = $this->company->present()->name();
|
||||
}
|
||||
|
||||
$this->nmo
|
||||
->mailable
|
||||
->from(config('services.ses.from.address'), $email_from_name);
|
||||
|
||||
}
|
||||
/**
|
||||
* Configures Mailgun using client supplied secret
|
||||
* as the Mailer
|
||||
|
|
|
|||
|
|
@ -546,20 +546,7 @@ class Email implements ShouldQueue
|
|||
|
||||
}
|
||||
|
||||
private function setHostedSesMailer()
|
||||
{
|
||||
|
||||
if (property_exists($this->email_object->settings, 'email_from_name') && strlen($this->email_object->settings->email_from_name) > 1) {
|
||||
$email_from_name = $this->email_object->settings->email_from_name;
|
||||
} else {
|
||||
$email_from_name = $this->company->present()->name();
|
||||
}
|
||||
|
||||
$this->mailable
|
||||
->from(config('services.ses.from.address'), $email_from_name);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the mail driver to use and applies any specific configuration
|
||||
* the the mailable
|
||||
|
|
@ -568,7 +555,7 @@ class Email implements ShouldQueue
|
|||
{
|
||||
|
||||
/** Force free/trials onto specific mail driver */
|
||||
if ($this->email_object->settings->email_sending_method == 'default' && $this->company->account->isNewHostedAccount()) {
|
||||
if ($this->email_object->settings->email_sending_method == 'default' && (!$this->company->account->isPaid() || $this->company->account->isNewHostedAccount())) {
|
||||
$this->mailer = 'mailgun';
|
||||
$this->setHostedMailgunMailer();
|
||||
return $this;
|
||||
|
|
@ -614,10 +601,6 @@ class Email implements ShouldQueue
|
|||
$this->mailer = 'mailgun';
|
||||
$this->setHostedMailgunMailer();
|
||||
return $this;
|
||||
case 'ses':
|
||||
$this->mailer = 'ses';
|
||||
$this->setHostedSesMailer();
|
||||
return $this;
|
||||
case 'gmail':
|
||||
$this->mailer = 'gmail';
|
||||
$this->setGmailMailer();
|
||||
|
|
|
|||
Loading…
Reference in New Issue