Browse Source

[hotfix] minor fixes

version-14
mbauskar 8 years ago
parent
commit
02cc55dd48
1 changed files with 7 additions and 6 deletions
  1. +7
    -6
      frappe/email/queue.py

+ 7
- 6
frappe/email/queue.py View File

@@ -224,11 +224,12 @@ def check_email_limit(recipients):
monthly_email_limit = 500 monthly_email_limit = 500
daily_email_limit = 50 daily_email_limit = 50


# get count of today's sent mails
today = get_emails_sent_today()
if daily_email_limit and (today + len(recipients)) > daily_email_limit:
throw(_("Cannot send this email. You have crossed the sending limit of {0} emails for this day.").format(daily_email_limit),
EmailLimitCrossedError)
if daily_email_limit:
# get count of sent mails in last 24 hours
today = get_emails_sent_today()
if (today + len(recipients)) > daily_email_limit:
throw(_("Cannot send this email. You have crossed the sending limit of {0} emails for this day.").format(daily_email_limit),
EmailLimitCrossedError)


if not monthly_email_limit: if not monthly_email_limit:
return return
@@ -246,7 +247,7 @@ def get_emails_sent_this_month():


def get_emails_sent_today(): def get_emails_sent_today():
return frappe.db.sql("""select count(name) from `tabEmail Queue` where return frappe.db.sql("""select count(name) from `tabEmail Queue` where
status='Sent' and DATE(creation)=CURDATE()""")[0][0]
status='Sent' and creation>DATE_SUB(NOW(), INTERVAL 24 HOUR)""")[0][0]


def get_unsubscribe_message(unsubscribe_message, expose_recipients): def get_unsubscribe_message(unsubscribe_message, expose_recipients):
if unsubscribe_message: if unsubscribe_message:


Loading…
Cancel
Save