mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-07-09 03:14:30 -04:00
Make spam limit a factor of the company age
This commit is contained in:
parent
a6cbe6f795
commit
3d9f000fd1
@ -158,7 +158,7 @@ if (! defined('APP_NAME')) {
|
||||
define('MAX_DOCUMENT_SIZE', env('MAX_DOCUMENT_SIZE', 10000)); // KB
|
||||
define('MAX_EMAIL_DOCUMENTS_SIZE', env('MAX_EMAIL_DOCUMENTS_SIZE', 10000)); // Total KB
|
||||
define('MAX_ZIP_DOCUMENTS_SIZE', env('MAX_EMAIL_DOCUMENTS_SIZE', 30000)); // Total KB (uncompressed)
|
||||
define('MAX_EMAILS_SENT_PER_DAY', 500);
|
||||
define('MAX_EMAILS_SENT_PER_DAY', 300);
|
||||
define('DOCUMENT_PREVIEW_SIZE', env('DOCUMENT_PREVIEW_SIZE', 300)); // pixels
|
||||
define('DEFAULT_FONT_SIZE', 9);
|
||||
define('DEFAULT_HEADER_FONT', 1); // Roboto
|
||||
|
@ -204,4 +204,13 @@ trait SendsEmails
|
||||
|
||||
return Domain::getEmailFromId($this->domain_id);
|
||||
}
|
||||
|
||||
public function getDailyEmailLimit()
|
||||
{
|
||||
$limit = MAX_EMAILS_SENT_PER_DAY;
|
||||
|
||||
$limit += $this->created_at->diffInMonths() * 100;
|
||||
|
||||
return min($limit, 1000);
|
||||
}
|
||||
}
|
||||
|
@ -381,7 +381,7 @@ class ContactMailer extends Mailer
|
||||
|
||||
// http://stackoverflow.com/questions/1375501/how-do-i-throttle-my-sites-api-users
|
||||
$day = 60 * 60 * 24;
|
||||
$day_limit = MAX_EMAILS_SENT_PER_DAY;
|
||||
$day_limit = $account->getDailyEmailLimit();
|
||||
$day_throttle = Cache::get("email_day_throttle:{$key}", null);
|
||||
$last_api_request = Cache::get("last_email_request:{$key}", 0);
|
||||
$last_api_diff = time() - $last_api_request;
|
||||
|
Loading…
x
Reference in New Issue
Block a user