diff --git a/frappe/core/doctype/communication/communication.py b/frappe/core/doctype/communication/communication.py index a8dca84b6d..6d372dd8b7 100644 --- a/frappe/core/doctype/communication/communication.py +++ b/frappe/core/doctype/communication/communication.py @@ -5,7 +5,7 @@ from __future__ import unicode_literals, absolute_import import frappe import json from email.utils import formataddr, parseaddr -from frappe.utils import get_url, get_formatted_email, cstr, cint, validate_email_add, split_emails +from frappe.utils import get_url, get_formatted_email, cint, validate_email_add, split_emails from frappe.utils.file_manager import get_file import frappe.email.smtp from frappe import _ @@ -106,7 +106,7 @@ class Communication(Document): from frappe.tasks import sendmail sendmail.delay(frappe.local.site, self.name, print_html=print_html, print_format=print_format, attachments=attachments, - recipients=recipients, cc=cc) + recipients=recipients, cc=cc, lang=frappe.local.lang) def _notify(self, print_html=None, print_format=None, attachments=None, recipients=None, cc=None): @@ -285,7 +285,7 @@ class Communication(Document): if email_address in exclude: continue - + if is_cc: is_user_enabled = frappe.db.get_value("User", email_address, "enabled") if is_user_enabled==0: @@ -296,7 +296,7 @@ class Communication(Document): if email_address not in email_address_list: # append the full email i.e. "Human " filtered.append(email) - email_address_list.append(email_address) + email_address_list.append(email_address) return filtered diff --git a/frappe/tasks.py b/frappe/tasks.py index ada78f7b08..dfbc607a2c 100644 --- a/frappe/tasks.py +++ b/frappe/tasks.py @@ -186,10 +186,13 @@ def run_async_task(self, site=None, user=None, cmd=None, form_dict=None, hijack_ @celery_task() def sendmail(site, communication_name, print_html=None, print_format=None, attachments=None, - recipients=None, cc=None): + recipients=None, cc=None, lang=None): try: frappe.connect(site=site) + if lang: + frappe.local.lang = lang + # upto 3 retries for i in xrange(3): try: