send newsletter as owner
This commit is contained in:
parent
ad86d0f474
commit
9ee4adb27a
@ -17,6 +17,7 @@
|
|||||||
from __future__ import unicode_literals
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
import webnotes
|
import webnotes
|
||||||
|
import webnotes.utils
|
||||||
|
|
||||||
class DocType():
|
class DocType():
|
||||||
def __init__(self, d, dl):
|
def __init__(self, d, dl):
|
||||||
@ -77,9 +78,11 @@ class DocType():
|
|||||||
|
|
||||||
def test_send(self, doctype="Lead"):
|
def test_send(self, doctype="Lead"):
|
||||||
args = self.dt_map[doctype]
|
args = self.dt_map[doctype]
|
||||||
|
sender = webnotes.utils.get_email_id(self.doc.owner)
|
||||||
recipients = self.doc.test_email_id.split(",")
|
recipients = self.doc.test_email_id.split(",")
|
||||||
from webnotes.utils.email_lib.bulk import send
|
from webnotes.utils.email_lib.bulk import send
|
||||||
send(recipients = recipients, subject = self.doc.subject, message = self.get_message(),
|
send(recipients = recipients, sender = sender,
|
||||||
|
subject = self.doc.subject, message = self.get_message(),
|
||||||
doctype = doctype, email_field = args["email_field"],
|
doctype = doctype, email_field = args["email_field"],
|
||||||
first_name_field = args["first_name_field"], last_name_field = "")
|
first_name_field = args["first_name_field"], last_name_field = "")
|
||||||
webnotes.msgprint("""Scheduled to send to %s""" % self.doc.test_email_id)
|
webnotes.msgprint("""Scheduled to send to %s""" % self.doc.test_email_id)
|
||||||
@ -98,10 +101,12 @@ class DocType():
|
|||||||
|
|
||||||
def send(self, query_key, doctype):
|
def send(self, query_key, doctype):
|
||||||
recipients = self.get_recipients(query_key)
|
recipients = self.get_recipients(query_key)
|
||||||
|
sender = webnotes.utils.get_email_id(self.doc.owner)
|
||||||
args = self.dt_map[doctype]
|
args = self.dt_map[doctype]
|
||||||
self.send_count[doctype] = self.send_count.setdefault(doctype, 0) + len(recipients)
|
self.send_count[doctype] = self.send_count.setdefault(doctype, 0) + len(recipients)
|
||||||
|
|
||||||
from webnotes.utils.email_lib.bulk import send
|
from webnotes.utils.email_lib.bulk import send
|
||||||
send(recipients = recipients, subject = self.doc.subject, message = self.get_message(),
|
send(recipients = recipients, sender = sender,
|
||||||
|
subject = self.doc.subject, message = self.get_message(),
|
||||||
doctype = doctype, email_field = args["email_field"],
|
doctype = doctype, email_field = args["email_field"],
|
||||||
first_name_field = args["first_name_field"], last_name_field = "")
|
first_name_field = args["first_name_field"], last_name_field = "")
|
Loading…
x
Reference in New Issue
Block a user