mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-07-08 16:44:31 -04:00
Adjustments for email quotas
This commit is contained in:
parent
fa828b3ab6
commit
fd06b42bc2
@ -145,7 +145,8 @@ class NinjaMailerJob implements ShouldQueue
|
|||||||
->send($mailable);
|
->send($mailable);
|
||||||
|
|
||||||
/* Count the amount of emails sent across all the users accounts */
|
/* Count the amount of emails sent across all the users accounts */
|
||||||
Cache::increment("email_quota".$this->company->account->key);
|
|
||||||
|
$this->incrementEmailCounter();
|
||||||
|
|
||||||
LightLogs::create(new EmailSuccess($this->nmo->company->company_key, $this->nmo->mailable->subject))
|
LightLogs::create(new EmailSuccess($this->nmo->company->company_key, $this->nmo->mailable->subject))
|
||||||
->send();
|
->send();
|
||||||
@ -221,6 +222,12 @@ class NinjaMailerJob implements ShouldQueue
|
|||||||
$this->cleanUpMailers();
|
$this->cleanUpMailers();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private function incrementEmailCounter(): void
|
||||||
|
{
|
||||||
|
if(in_array($this->mailer, ['default','mailgun']))
|
||||||
|
Cache::increment("email_quota".$this->company->account->key);
|
||||||
|
|
||||||
|
}
|
||||||
/**
|
/**
|
||||||
* Entity notification when an email fails to send
|
* Entity notification when an email fails to send
|
||||||
*
|
*
|
||||||
|
@ -244,6 +244,12 @@ class Email implements ShouldQueue
|
|||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private function incrementEmailCounter(): void
|
||||||
|
{
|
||||||
|
if(in_array($this->mailer, ['default','mailgun']))
|
||||||
|
Cache::increment("email_quota".$this->company->account->key);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Attempts to send the email
|
* Attempts to send the email
|
||||||
*
|
*
|
||||||
@ -270,7 +276,7 @@ class Email implements ShouldQueue
|
|||||||
|
|
||||||
$mailer->send($this->mailable);
|
$mailer->send($this->mailable);
|
||||||
|
|
||||||
Cache::increment("email_quota".$this->company->account->key);
|
$this->incrementEmailCounter();
|
||||||
|
|
||||||
LightLogs::create(new EmailSuccess($this->company->company_key, $this->mailable->subject))
|
LightLogs::create(new EmailSuccess($this->company->company_key, $this->mailable->subject))
|
||||||
->send();
|
->send();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user