mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2024-11-10 13:12:50 +01:00
Gracefully fall back when smtp configuration is incorrect
This commit is contained in:
parent
7a128ecb10
commit
a31cd1c407
@ -363,7 +363,7 @@ nlog("nn");
|
||||
return $this;
|
||||
}
|
||||
|
||||
private function configureSmtpMailer(): void
|
||||
private function configureSmtpMailer()
|
||||
{
|
||||
|
||||
$company = $this->company;
|
||||
@ -376,6 +376,16 @@ nlog("nn");
|
||||
$smtp_local_domain = strlen($company->smtp_local_domain) > 2 ? $company->smtp_local_domain : null;
|
||||
$smtp_verify_peer = $company->smtp_verify_peer ?? true;
|
||||
|
||||
if(strlen($smtp_host ?? '') <= 1 ||
|
||||
strlen($smtp_username ?? '') <= 1 ||
|
||||
strlen($smtp_password ?? '') <= 1
|
||||
)
|
||||
{
|
||||
$this->nmo->settings->email_sending_method = 'default';
|
||||
return $this->setMailDriver();
|
||||
}
|
||||
|
||||
|
||||
config([
|
||||
'mail.mailers.smtp' => [
|
||||
'transport' => 'smtp',
|
||||
|
@ -589,7 +589,7 @@ $this->entityEmailFailed($message);
|
||||
return $this;
|
||||
}
|
||||
|
||||
private function configureSmtpMailer(): void
|
||||
private function configureSmtpMailer()
|
||||
{
|
||||
|
||||
$company = $this->company;
|
||||
@ -602,6 +602,14 @@ $this->entityEmailFailed($message);
|
||||
$smtp_local_domain = strlen($company->smtp_local_domain) > 2 ? $company->smtp_local_domain : null;
|
||||
$smtp_verify_peer = $company->smtp_verify_peer ?? true;
|
||||
|
||||
if(strlen($smtp_host ?? '') <= 1 ||
|
||||
strlen($smtp_username ?? '') <= 1 ||
|
||||
strlen($smtp_password ?? '') <= 1
|
||||
) {
|
||||
$this->email_object->settings->email_sending_method = 'default';
|
||||
return $this->setMailDriver();
|
||||
}
|
||||
|
||||
config([
|
||||
'mail.mailers.smtp' => [
|
||||
'transport' => 'smtp',
|
||||
|
Loading…
Reference in New Issue
Block a user