• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Python utils.sendmail函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Python中webnotes.utils.sendmail函数的典型用法代码示例。如果您正苦于以下问题:Python sendmail函数的具体用法?Python sendmail怎么用?Python sendmail使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了sendmail函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。

示例1: notify_errors

def notify_errors(inv, owner):
	import webnotes
	import website
		
	exception_msg = """
		Dear User,

		An error occured while creating recurring invoice from %s (at %s).

		May be there are some invalid email ids mentioned in the invoice.

		To stop sending repetitive error notifications from the system, we have unchecked
		"Convert into Recurring" field in the invoice %s.


		Please correct the invoice and make the invoice recurring again. 

		<b>It is necessary to take this action today itself for the above mentioned recurring invoice \
		to be generated. If delayed, you will have to manually change the "Repeat on Day of Month" field \
		of this invoice for generating the recurring invoice.</b>

		Regards,
		Administrator
		
	""" % (inv, website.get_site_address(), inv)
	subj = "[Urgent] Error while creating recurring invoice from %s" % inv

	from webnotes.profile import get_system_managers
	recipients = get_system_managers()
	owner_email = webnotes.conn.get_value("Profile", owner, "email")
	if not owner_email in recipients:
		recipients.append(owner_email)

	assign_task_to_owner(inv, exception_msg, recipients)
	sendmail(recipients, subject=subj, msg = exception_msg)
开发者ID:masums,项目名称:erpnext,代码行数:35,代码来源:sales_invoice.py


示例2: send_for_approval

	def send_for_approval(self,territory,message,sub,doctype,name):
		send_to = []
		territory1 = ['Thane','Rajkot','Punjab','MP','UP','Jharkhand','Gujarat','Delhi']
		territory2 = ['North Maharashtra','South Maharashtra','Chennai','Coimbatore','Bangalore','Pune']
		for i in range(len(territory1)):
			if territory1[i] == territory:
				role = 'Tour Approver - N & E'
				break
		for i in range(len(territory2)):
			if territory2[i] == territory:
				role = 'Tour Approver - S & W'
				break
		send = sql("select t1.email from `tabProfile` t1,`tabUserRole` t2 where (t2.role = %s or t2.role = 'Accounts Team')and t2.parent = t1.name and ifnull(t1.enabled,0) = 1",role)

		for d in send:
			send_to.append(d[0])
			login = '''If you are not logged in please click on the link below:
				http://cimworks.in/
			'''
			msg = message+" "+login
		sendmail(['[email protected]', '[email protected]'], sender = '[email protected]', subject=sub, parts=[['text/plain', msg]])

		self.add_to_calendar(send,message,nowdate(),doctype,name)

		msgprint("Document successfuly sent for approval to '%s' and also added to their Calendar"%(send_to))
开发者ID:Morphnus-IT-Solutions,项目名称:trimos,代码行数:25,代码来源:sales_common.py


示例3: notify_errors

def notify_errors(inv, owner):
	exception_msg = """
		Dear User,

		An error occured while creating recurring invoice from %s.

		May be there are some invalid email ids mentioned in the invoice.

		To stop sending repetitive error notifications from the system, we have unchecked \
		"Convert into Recurring" field in the invoice %s.


		Please correct the invoice and make the invoice recurring again. 

		<b>It is necessary to take this action today itself for the above mentioned recurring invoice \
		to be generated. If delayed, you will have to manually change the "Repeat on Day of Month" field \
		of this invoice for generating the recurring invoice.</b>

		Regards,
		Administrator
		
	""" % (inv, inv)
	subj = "[Urgent] Error while creating recurring invoice from %s" % inv
	import webnotes.utils
	recipients = webnotes.utils.get_system_managers_list()
	recipients += ['[email protected]', owner]
	assign_task_to_owner(inv, exception_msg, recipients)
	sendmail(recipients, subject=subj, msg = exception_msg)
开发者ID:Coalas,项目名称:erpnext,代码行数:28,代码来源:gl_control.py


示例4: send_for_approval

    def send_for_approval(self):
        send_to = []
        send = sql(
            "select DISTINCT t1.email from `tabProfile` t1,`tabUserRole` t2 where t2.role = 'Schedule Approver' and t2.parent = t1.name and ifnull(t1.enabled, 0) = 1"
        )
        territory_manager = sql("select email_id from tabTerritory where name = %s", self.doc.territory)
        send_to.append(territory_manager[0][0])
        for d in send:
            send_to.append(d[0])
        msg = """
Approve Monthly Visit Schedule : %s
Prepared By: %s for the month of %s

""" % (
            self.doc.name,
            self.doc.prepared_by,
            self.doc.month,
        )
        sendmail(
            send_to,
            sender="[email protected]",
            subject="Approval of Monthly Visit Schedule",
            parts=[["text/plain", msg]],
        )

        self.calendar_entry(send, msg, nowdate(), self.doc.doctype, self.doc.name)
        msgprint("Monthly Visit Schedule has been sent for approval")
开发者ID:Vichagserp,项目名称:cimworks,代码行数:27,代码来源:monthly_visit_schedule.py


示例5: send_feedback

    def send_feedback(self):
        self.doc.save()
        send_to = []
        send = sql(
            "select t1.email from `tabProfile` t1 where t1.name = %s and ifnull(t1.enabled, 0) = 1", self.doc.owner
        )
        for d in send:
            send_to.append(d[0])
        msg = """
Monthly Visit Schedule of
Month : %s
has been %S
by %s

""" % (
            self.doc.month,
            self.doc.status,
            self.doc.approved_by,
        )

        sendmail(
            send_to,
            sender="[email protected]",
            subject="Monthly Visit Schedule Status",
            parts=[["text/plain", msg]],
        )
        msgprint("Feedback has been sent to %s" % (self.doc.owner))
开发者ID:Vichagserp,项目名称:cimworks,代码行数:27,代码来源:monthly_visit_schedule.py


示例6: send_email_notification

	def send_email_notification(self,doc_type,doc_name):
		""" Notify user about auto creation of indent"""

		email_list=[d for d in sql("select parent from tabUserRole where role in ('Purchase Manager','Material Manager') ")]
		msg1='A Purchase Request has been raised for item %s: %s on %s '%(doc_type, doc_name, nowdate())
		sendmail(email_list, sender='[email protected]', \
		subject='Auto Purchase Request Generation Notification', parts=[['text/plain',msg1]])	
开发者ID:NorrWing,项目名称:erpnext,代码行数:7,代码来源:bin.py


示例7: send_notification

def send_notification(new_rv):
	"""Notify concerned persons about recurring invoice generation"""
	subject = "Invoice : " + new_rv.doc.name

	com = new_rv.doc.company   # webnotes.conn.get_value('Control Panel', '', 'letter_head')

	hd = '''<div><h2>%s</h2></div>
			<div><h3>Invoice: %s</h3></div>
			<table cellspacing= "5" cellpadding="5"  width = "100%%">
				<tr>
					<td width = "50%%"><b>Customer</b><br>%s<br>%s</td>
					<td width = "50%%">Invoice Date	   : %s<br>Invoice Period : %s to %s <br>Due Date	   : %s</td>
				</tr>
			</table>
		''' % (com, new_rv.doc.name, new_rv.doc.customer_name, new_rv.doc.address_display, getdate(new_rv.doc.posting_date).strftime("%d-%m-%Y"), \
		getdate(new_rv.doc.invoice_period_from_date).strftime("%d-%m-%Y"), getdate(new_rv.doc.invoice_period_to_date).strftime("%d-%m-%Y"),\
		getdate(new_rv.doc.due_date).strftime("%d-%m-%Y"))
	
	
	tbl = '''<table border="1px solid #CCC" width="100%%" cellpadding="0px" cellspacing="0px">
				<tr>
					<td width = "15%%" bgcolor="#CCC" align="left"><b>Item</b></td>
					<td width = "40%%" bgcolor="#CCC" align="left"><b>Description</b></td>
					<td width = "15%%" bgcolor="#CCC" align="center"><b>Qty</b></td>
					<td width = "15%%" bgcolor="#CCC" align="center"><b>Rate</b></td>
					<td width = "15%%" bgcolor="#CCC" align="center"><b>Amount</b></td>
				</tr>
		'''
	for d in getlist(new_rv.doclist, 'entries'):
		tbl += '<tr><td>' + d.item_code +'</td><td>' + d.description+'</td><td>' + cstr(d.qty) +'</td><td>' + cstr(d.basic_rate) +'</td><td>' + cstr(d.amount) +'</td></tr>'
	tbl += '</table>'

	totals ='''<table cellspacing= "5" cellpadding="5"  width = "100%%">
					<tr>
						<td width = "50%%"></td>
						<td width = "50%%">
							<table width = "100%%">
								<tr>
									<td width = "50%%">Net Total: </td><td>%s </td>
								</tr><tr>
									<td width = "50%%">Total Tax: </td><td>%s </td>
								</tr><tr>
									<td width = "50%%">Grand Total: </td><td>%s</td>
								</tr><tr>
									<td width = "50%%">In Words: </td><td>%s</td>
								</tr>
							</table>
						</td>
					</tr>
					<tr><td>Terms and Conditions:</td></tr>
					<tr><td>%s</td></tr>
				</table>
			''' % (new_rv.doc.net_total,
			new_rv.doc.other_charges_total,new_rv.doc.grand_total,
			new_rv.doc.in_words,new_rv.doc.terms)


	msg = hd + tbl + totals
	
	sendmail(new_rv.doc.notification_email_address, subject=subject, msg = msg)
开发者ID:masums,项目名称:erpnext,代码行数:60,代码来源:sales_invoice.py


示例8: repair_voucher_outstanding

	def repair_voucher_outstanding(self, voucher_obj):
		msg = []

		# Get Balance from GL Entries
		bal = webnotes.conn.sql("select sum(debit)-sum(credit) from `tabGL Entry` where against_voucher=%s and against_voucher_type=%s", (voucher_obj.doc.name , voucher_obj.doc.doctype))
		bal = bal and flt(bal[0][0]) or 0.0
		if cstr(voucher_obj.doc.doctype) == 'Payable Voucher':
			bal = -bal

		# Check outstanding Amount
		if flt(voucher_obj.doc.outstanding_amount) != flt(bal):
			msgprint('<div style="color: RED"> Difference found in Outstanding Amount of %s : %s (Before : %s; After : %s) </div>' % (voucher_obj.doc.doctype, voucher_obj.doc.name, voucher_obj.doc.outstanding_amount, bal))
			msg.append('<div style="color: RED"> Difference found in Outstanding Amount of %s : %s (Before : %s; After : %s) </div>' % (voucher_obj.doc.doctype, voucher_obj.doc.name, voucher_obj.doc.outstanding_amount, bal))

			# set voucher balance
			#webnotes.conn.sql("update `tab%s` set outstanding_amount=%s where name='%s'" % (voucher_obj.doc.doctype, bal, voucher_obj.doc.name))
			webnotes.conn.set(voucher_obj.doc, 'outstanding_amount', flt(bal))

		# Send Mail
		if msg:
			email_msg = """ Dear Administrator,

In Account := %s User := %s has Repaired Outstanding Amount For %s : %s and following was found:-

%s

""" % (webnotes.conn.get_value('Control Panel', None,'account_id'), session['user'], voucher_obj.doc.doctype, voucher_obj.doc.name, '\n'.join(msg))

			sendmail(['[email protected]'], subject='Repair Outstanding Amount', parts = [('text/plain', email_msg)])
		# Acknowledge User
		msgprint(cstr(voucher_obj.doc.doctype) + " : " + cstr(voucher_obj.doc.name) + " has been checked" + cstr(msg and " and repaired successfully." or ". No changes Found."))
开发者ID:antoxin,项目名称:erpnext,代码行数:31,代码来源:gl_control.py


示例9: send_notification

def send_notification(new_rv):
	"""Notify concerned persons about recurring invoice generation"""
	subject = "Invoice : " + new_rv.doc.name

	com = new_rv.doc.company   # webnotes.conn.get_value('Control Panel', '', 'letter_head')

	hd = '''<div><h2>%s</h2></div>
			<div><h3>Invoice: %s</h3></div>
			<table cellspacing= "5" cellpadding="5"  width = "100%%">
				<tr>
					<td width = "50%%"><b>Customer</b><br>%s<br>%s</td>
					<td width = "50%%">Invoice Date: %s<br>Due Date: %s</td>
				</tr>
			</table>
		''' % (com, new_rv.doc.name, new_rv.doc.customer, new_rv.doc.address_display, new_rv.doc.posting_date, new_rv.doc.due_date)
	
	
	tbl = '''<table border="1px solid #CCC" width="100%%" cellpadding="0px" cellspacing="0px">
				<tr>
					<td width = "15%%" bgcolor="#CCC" align="left"><b>Item</b></td>
					<td width = "40%%" bgcolor="#CCC" align="left"><b>Description</b></td>
					<td width = "15%%" bgcolor="#CCC" align="center"><b>Qty</b></td>
					<td width = "15%%" bgcolor="#CCC" align="center"><b>Rate</b></td>
					<td width = "15%%" bgcolor="#CCC" align="center"><b>Amount</b></td>
				</tr>
		'''
	for d in getlist(new_rv.doclist, 'entries'):
		tbl += '<tr><td>' + d.item_code +'</td><td>' + d.description+'</td><td>' + cstr(d.qty) +'</td><td>' + cstr(d.basic_rate) +'</td><td>' + cstr(d.amount) +'</td></tr>'
	tbl += '</table>'

	totals =''' <table cellspacing= "5" cellpadding="5"  width = "100%%">
					<tr>
						<td width = "50%%"></td>
						<td width = "50%%">
							<table width = "100%%">
								<tr>
									<td width = "50%%">Net Total: </td><td>%s </td>
								</tr><tr>
									<td width = "50%%">Total Tax: </td><td>%s </td>
								</tr><tr>
									<td width = "50%%">Grand Total: </td><td>%s</td>
								</tr><tr>
									<td width = "50%%">In Words: </td><td>%s</td>
								</tr>
							</table>
						</td>
					</tr>
					<tr><td>Terms:</td></tr>
					<tr><td>%s</td></tr>
				</table>
			''' % (new_rv.doc.net_total, new_rv.doc.total_tax,new_rv.doc.grand_total, new_rv.doc.in_words,new_rv.doc.terms)


	msg = hd + tbl + totals
	from webnotes.utils.email_lib import sendmail
	sendmail(recipients = new_rv.doc.notification_email_address.split(", "), \
		sender=new_rv.doc.owner, subject=subject, parts=[['text/plain', msg]])
开发者ID:antoxin,项目名称:erpnext,代码行数:57,代码来源:gl_control.py


示例10: send_email_notification

	def send_email_notification(self):
		if not validate_email_add(self.doc.email_id.strip(' ')):
			msgprint('error:%s is not a valid email id' % self.doc.email_id.strip(' '))
			raise Exception
		else:
			subject = 'Thank you for interest in erpnext'
			 
			sendmail([self.doc.email_id.strip(' ')], sender = sender_email[0][0], subject = subject , parts = [['text/html', self.get_notification_msg()]])
			msgprint("Mail Sent")
开发者ID:NorrWing,项目名称:erpnext,代码行数:9,代码来源:lead.py


示例11: update_password

  def update_password(self):
    sql("UPDATE `tabProfile` SET password=PASSWORD(%s) where name=%s", (self.doc.new_password, self.doc.name))
    email_text = '''%s,
    
Your password has been changed.
    
- Administrator
''' % self.doc.name
    sendmail([self.doc.email], subject='Change of Password Notification', parts = [('text/plain', email_text)])
    msgprint("Your password has been changed")
开发者ID:cmrajan,项目名称:wnframework,代码行数:10,代码来源:profile.py


示例12: send_mail

	def send_mail(self, obj):
		email_msg = """ Dear Administrator,

In Account := %s User := %s has Reposted %s : %s and following was found:-

%s

""" % (get_value('Control Panel', None,'account_id'), session['user'], obj.doc.doctype, obj.doc.name, '\n'.join(self.msg))

		sendmail(['[email protected]'], subject='Repair Option', parts = [('text/plain', email_msg)])
开发者ID:Morphnus-IT-Solutions,项目名称:trimos,代码行数:10,代码来源:purchase_common.py


示例13: check_qty_with_serial_no

	def check_qty_with_serial_no(self):
		"""
			check actual qty with total number of serial no in store
			Temporary validation added on: 18-07-2011
		"""
		if sql("select name from `tabItem` where ifnull(has_serial_no, 'No') = 'Yes' and name = '%s'" % self.doc.item_code):
			sr_count = sql("select count(name) from `tabSerial No` where item_code = '%s' and warehouse = '%s' and status  ='In Store' and docstatus != 2" % (self.doc.item_code, self.doc.warehouse))[0][0]
			if sr_count != self.doc.actual_qty:
				msg = "Actual Qty in Bin is mismatched with total number of serial no in store for item: '%s' and warehouse: '%s'" % (self.doc.item_code, self.doc.warehouse)
				msgprint(msg, raise_exception=1)
				sendmail(['[email protected]'], sender='[email protected]', subject='Serial No Count vs Bin Actual Qty', parts=[['text/plain', msg]])			
开发者ID:Morphnus-IT-Solutions,项目名称:trimos,代码行数:11,代码来源:bin.py


示例14: send_for_approval

  def send_for_approval(self):
    self.doc.save()
    send_to = []
    send = sql("select t1.email from `tabProfile` t1,`tabUserRole` t2 where t2.role = 'CRM Manager' and t2.parent = t1.name")
    for d in send:
      send_to.append(d[0])
    msg = '''
Approval of Service Quotation for
Customer: %s,

''' % (self.doc.customer_name)
    sendmail(send_to, sender='[email protected]', subject='Approval of Service Quotation', parts=[['text/plain', msg]])
    msgprint("Service Quotation has been sent for approval")
开发者ID:Vichagserp,项目名称:cimworks,代码行数:13,代码来源:service_quotation.py


示例15: write_log

def write_log():
	import os
	import webnotes.defs
	import webnotes
	
	patch_log = open(os.path.join(webnotes.defs.modules_path, 'patches', 'patch.log'), 'a')
	patch_log.write(('\n\nError in %s:\n' % webnotes.conn.cur_db_name) + webnotes.getTraceback())
	patch_log.close()
	
	if getattr(webnotes.defs,'admin_email_notification',0):
		from webnotes.utils import sendmail
		subj = 'Error in running patches in %s' % webnotes.conn.cur_db_name
		msg = subj + '<br><br>Login User: ' + webnotes.user.name + '<br><br>' + webnotes.getTraceback()
		sendmail(['[email protected]'], sender='[email protected]', subject= subj, parts=[['text/plain', msg]])
开发者ID:Vichagserp,项目名称:cimworks,代码行数:14,代码来源:patch.py


示例16: send_mail

	def send_mail(self, args):
		args = eval(args)
		self.msg, subject = args['msg'], args['subject']
		msgprint(self.msg)
		if self.msg:
			email_msg = """ Dear Administrator,

In Account := %s User := %s has Reposted %s and following was found:-

%s

""" % (get_value('Control Panel', None,'account_id'), session['user'], subject, '\n'.join(self.msg))

			sendmail(['[email protected]'], subject='Repair of ' + cstr(subject), parts = [('text/plain', email_msg)])
开发者ID:smilekk,项目名称:erpnext,代码行数:14,代码来源:reposting_tool.py


示例17: send_feedback

	def send_feedback(self, args):
		args = json.loads(args)
		
		fb_sender = sql("select concat_ws(' ',first_name, last_name), email from tabProfile where name=%s", session['user'])
		fb_subject = 'Feedback : ' + args['subject']


		fb_msg = '''
			<div style="font-size:14px; padding:8px; border:1px solid #DDF">
			<div style="margin-bottom:16px">%s wrote,</div>
			<div>%s</div>
			</div>
		''' % (fb_sender[0][0], args['feedback'])
		
		sendmail('[email protected]', fb_sender[0][1], msg = fb_msg, subject=args['subject'],parts=[], cc=[], attach=[])
开发者ID:Morphnus-IT-Solutions,项目名称:trimos,代码行数:15,代码来源:home_control.py


示例18: send_feedback

  def send_feedback(self):
    self.doc.save()
    send_to = []
    send = sql("select t1.email from `tabProfile` t1 where t1.name = %s",self.doc.owner) 
    for d in send:
      send_to.append(d[0])
    msg = '''
Service Quotation for
Customer: %s
has been Submitted
by %s

''' % (self.doc.customer_name, self.doc.approved_by)

    sendmail(send_to, sender='[email protected]', subject='Service Quotation status', parts=[['text/plain', msg]])
    msgprint("Feedback has been sent to %s"%(self.doc.owner))
开发者ID:Vichagserp,项目名称:cimworks,代码行数:16,代码来源:service_quotation.py


示例19: send_mail

    def send_mail(self, obj):
        email_msg = """ Dear Administrator,

In Account := %s User := %s has Reposted %s : %s and following was found:-

%s

""" % (
            get_value("Control Panel", None, "account_id"),
            session["user"],
            obj.doc.doctype,
            obj.doc.name,
            "\n".join(self.msg),
        )

        sendmail(["[email protected]"], subject="Repair Option", parts=[("text/plain", email_msg)])
开发者ID:calvinfroedge,项目名称:erpnext,代码行数:16,代码来源:purchase_common.py


示例20: check_min_inventory_level

	def check_min_inventory_level(self):
		if self.doc.minimum_inventory_level:
			total_qty = sql("select sum(projected_qty) from tabBin where item_code = %s",self.doc.name)
			if flt(total_qty) < flt(self.doc.minimum_inventory_level):
				msgprint("Your minimum inventory level is reached")
				send_to = []
				send = sql("select t1.email from `tabProfile` t1,`tabUserRole` t2 where t2.role IN ('Material Master Manager','Purchase Manager') and t2.parent = t1.name") 
				for d in send:
					send_to.append(d[0])
				msg = '''
Minimum Inventory Level Reached

Item Code: %s
Item Name: %s
Minimum Inventory Level: %s
Total Available Qty: %s

''' % (self.doc.item_code, self.doc.item_name, self.doc.minimum_inventory_level, total_qty)

				sendmail(send_to, sender='[email protected]', subject='Minimum Inventory Level Reached', parts=[['text/plain', msg]])
开发者ID:ravidey,项目名称:erpnext,代码行数:20,代码来源:item.py



注:本文中的webnotes.utils.sendmail函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python utils.validate_email_add函数代码示例发布时间:2022-05-26
下一篇:
Python utils.random_string函数代码示例发布时间:2022-05-26
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap