def notify(self, print_html=None, print_format=None, attachments=None, recipients=None, except_recipient=False): """Calls a delayed celery task 'sendmail' that enqueus email in Bulk Email queue :param print_html: Send given value as HTML attachment :param print_format: Attach print format of parent document :param attachments: A list of filenames that should be attached when sending this email :param recipients: Email recipients :param except_recipient: True when pulling email, the notification shouldn't go to the main recipient """ if frappe.flags.in_test: # for test cases, run synchronously self._notify(print_html=print_html, print_format=print_format, attachments=attachments, recipients=recipients, except_recipient=except_recipient) else: from frappe.tasks import sendmail sendmail.delay(frappe.local.site, self.name, print_html=print_html, print_format=print_format, attachments=attachments, recipients=recipients, except_recipient=except_recipient)
def notify(self, print_html=None, print_format=None, attachments=None, recipients=None, cc=None, fetched_from_email_account=False): """Calls a delayed celery task 'sendmail' that enqueus email in Bulk Email queue :param print_html: Send given value as HTML attachment :param print_format: Attach print format of parent document :param attachments: A list of filenames that should be attached when sending this email :param recipients: Email recipients :param cc: Send email as CC to :param fetched_from_email_account: True when pulling email, the notification shouldn't go to the main recipient """ recipients, cc = self.get_recipients_and_cc(recipients, cc, fetched_from_email_account=fetched_from_email_account) self.emails_not_sent_to = set(self.all_email_addresses) - set(recipients) - set(cc) if frappe.flags.in_test: # for test cases, run synchronously self._notify(print_html=print_html, print_format=print_format, attachments=attachments, recipients=recipients, cc=cc) else: 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)
def notify(doc, print_html=None, print_format=None, attachments=None, recipients=None, cc=None, fetched_from_email_account=False): """Calls a delayed celery task 'sendmail' that enqueus email in Bulk Email queue :param print_html: Send given value as HTML attachment :param print_format: Attach print format of parent document :param attachments: A list of filenames that should be attached when sending this email :param recipients: Email recipients :param cc: Send email as CC to :param fetched_from_email_account: True when pulling email, the notification shouldn't go to the main recipient """ recipients, cc = get_recipients_and_cc(doc, recipients, cc, fetched_from_email_account=fetched_from_email_account) doc.emails_not_sent_to = set(doc.all_email_addresses) - set(doc.sent_email_addresses) if frappe.flags.in_test: # for test cases, run synchronously doc._notify(print_html=print_html, print_format=print_format, attachments=attachments, recipients=recipients, cc=cc) else: check_bulk_limit(list(set(doc.sent_email_addresses))) from frappe.tasks import sendmail sendmail.delay(frappe.local.site, doc.name, print_html=print_html, print_format=print_format, attachments=attachments, recipients=recipients, cc=cc, lang=frappe.local.lang, session=frappe.local.session)