Fix: Notify via email on new post on my company page
This commit is contained in:
parent
a550c06729
commit
cb1f361461
@ -119,17 +119,26 @@ def post_comment(arg):
|
||||
else:
|
||||
fn = webnotes.user.name
|
||||
|
||||
from webnotes.utils.email_lib import sendmail
|
||||
from setup.doctype.notification_control.notification_control import get_formatted_message
|
||||
|
||||
message = '''A new comment has been posted on your page by %s:
|
||||
|
||||
<b>Comment:</b> %s
|
||||
|
||||
To answer, please login to your erpnext account!
|
||||
|
||||
<a href='https://signin.erpnext.com'>https://signin.erpnext.com</a>
|
||||
''' % (fn, arg['comment'])
|
||||
|
||||
sendmail([arg['uid']], webnotes.user.name, get_formatted_message('New Comment', message), fn + ' has posted a new comment')
|
||||
from webnotes.model.code import get_obj
|
||||
note = get_obj('Notification Control')
|
||||
email_msg = note.prepare_message({
|
||||
'type': 'New Comment',
|
||||
'message': message
|
||||
})
|
||||
|
||||
sender = webnotes.user.name!='Administrator' and webnotes.user.name or 'support+admin_post@erpnext.com'
|
||||
|
||||
from webnotes.utils.email_lib import sendmail
|
||||
sendmail([arg['uid']], sender, email_msg, fn + ' has posted a new comment')
|
||||
|
||||
#
|
||||
# update read messages
|
||||
|
@ -55,9 +55,9 @@ class DocType:
|
||||
"""
|
||||
Prepares message body
|
||||
"""
|
||||
if args.get('type') and args.get('doctype'):
|
||||
if args.get('type'):
|
||||
msg_dict = {}
|
||||
msg_dict['message'] = self.get_message(args.get('type'))
|
||||
msg_dict['message'] = args.get('message') or self.get_message(args.get('type'))
|
||||
msg_dict['company'] = Document('Control Panel', 'Control Panel').company_name
|
||||
msg_dict['salutation'] = "Hi" + (args.get('contact_name') and (" " + args.get('contact_name')) or "")
|
||||
msg_dict['send_from'] = webnotes.conn.sql("""\
|
||||
|
Loading…
x
Reference in New Issue
Block a user