mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-07-08 10:14:30 -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);
|
||||
|
||||
/* 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))
|
||||
->send();
|
||||
@ -221,6 +222,12 @@ class NinjaMailerJob implements ShouldQueue
|
||||
$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
|
||||
*
|
||||
|
@ -244,6 +244,12 @@ class Email implements ShouldQueue
|
||||
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
|
||||
*
|
||||
@ -270,7 +276,7 @@ class Email implements ShouldQueue
|
||||
|
||||
$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))
|
||||
->send();
|
||||
|
Loading…
x
Reference in New Issue
Block a user