mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-05-24 02:14:21 -04:00
Email Quotas for hosted
This commit is contained in:
parent
0196724348
commit
6202762bbf
@ -40,6 +40,7 @@ use Illuminate\Support\Facades\Config;
|
||||
use Illuminate\Support\Facades\Lang;
|
||||
use Illuminate\Support\Facades\Mail;
|
||||
use Turbo124\Beacon\Facades\LightLogs;
|
||||
use Illuminate\Support\Facades\Cache;
|
||||
|
||||
/*Multi Mailer implemented*/
|
||||
|
||||
@ -110,11 +111,10 @@ class NinjaMailerJob implements ShouldQueue
|
||||
LightLogs::create(new EmailSuccess($this->nmo->company->company_key))
|
||||
->batch();
|
||||
|
||||
/* Count the amount of emails sent across all the users accounts */
|
||||
Cache::increment($this->company->account->key);
|
||||
|
||||
} catch (\Exception $e) {
|
||||
|
||||
// if($e instanceof GuzzleHttp\Exception\ClientException){
|
||||
|
||||
// }
|
||||
|
||||
nlog("error failed with {$e->getMessage()}");
|
||||
|
||||
@ -227,6 +227,10 @@ class NinjaMailerJob implements ShouldQueue
|
||||
if(Ninja::isHosted() && strpos($this->nmo->to_user->email, '@example.com') !== false)
|
||||
return true;
|
||||
|
||||
/* On the hosted platform, if the user is over the email quotas, we do not send the email. */
|
||||
//if(Ninja::isHosted())
|
||||
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -254,4 +258,5 @@ class NinjaMailerJob implements ShouldQueue
|
||||
LightLogs::create($job_failure)
|
||||
->batch();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,30 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class AddEmailQuotaToAccountsTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::table('accounts', function (Blueprint $table) {
|
||||
$table->unsignedInteger('email_quota')->nullable()->default(300);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
|
||||
}
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user