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

Python email_lib.sendmail函数代码示例

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

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



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

示例1: send_notification

	def send_notification(self):
		i = {
			'subject' : self.doc.subject,
			'name' : self.doc.name,
			'senders_name': self.doc.senders_name,
			'opening_date': self.doc.opening_date,
			'exp_start_date': self.doc.exp_start_date,
			'exp_end_date' : self.doc.exp_end_date,
			'subject' : self.doc.subject,
			'project': self.doc.project,
			'review_date': self.doc.review_date,
			'description': self.doc.description
		}

		task_label = '[Task Updated] '
		if self.doc.creation==self.doc.modified:
			task_label = '[New Task] '

		msg2="""<h2>%(name)s</h2>
			<p>This is a Notification for the task %(name)s that has been assigned / updated to you 
				by %(senders_name)s on %(opening_date)s</p>
			<p><b>Subject:</b> %(subject)s </p>
			<p><b>Project:</b> %(project)s</p>
			<p><b>Expected Start Date:</b> %(exp_start_date)s</p>
			<p><b>Expected End Date:</b> %(exp_end_date)s</p>
			<p><b>Details:</b> %(description)s</p>
			<p>(This notification is autogenerated)</p>""" % i
		sendmail(self.doc.allocated_to, sender='[email protected]', msg=msg2,send_now=1,\
			subject= task_label + self.doc.subject)
开发者ID:nijil,项目名称:erpnext,代码行数:29,代码来源:task.py


示例2: send_email

	def send_email(self, backup_file):
		"""
			Sends the link to backup file located at erpnext/backups
		"""
		if hasattr(webnotes.defs, 'backup_url'):
			backup_url = webnotes.defs.backup_url
		else:
			backup_url = webnotes.conn.get_value('Website Settings',
				'Website Settings', 'subdomain') or ''
			if hasattr(webnotes.defs, 'backup_folder_name'):
				backup_url = os.path.join(backup_url,
						webnotes.defs.backup_folder_name)
		file_url = os.path.join(backup_url, backup_file)
		from webnotes.utils.email_lib import sendmail
		
		recipient_list = self.get_recipients()
		msg = """<a href=%(file_url)s>Click here to begin downloading\
		 your backup</a>
		 
		 This link will be valid for 24 hours.
		 
		 Also, a new backup will be available for download (if requested)\
		  only after 24 hours.""" % {"file_url":file_url}
		
		datetime_str = datetime.fromtimestamp(os.stat(self.db_file_name.replace('\$', '$')).st_ctime)
		
		subject = datetime_str.strftime("%d/%m/%Y %H:%M:%S") + """ - Backup ready to be downloaded"""
		sendmail(recipients=recipient_list, msg=msg, subject=subject)
		return recipient_list
开发者ID:beliezer,项目名称:wnframework,代码行数:29,代码来源:backups.py


示例3: send_message

def send_message(subject="Website Query", message="", sender=""):
    if not message:
        webnotes.response["message"] = "Please write something"
        return

    if not sender:
        webnotes.response["message"] = "Email Id Required"
        return

        # guest method, cap max writes per hour
    if (
        webnotes.conn.sql(
            """select count(*) from `tabCommunication`
		where TIMEDIFF(%s, modified) < '01:00:00'""",
            now(),
        )[0][0]
        > max_communications_per_hour
    ):
        webnotes.response[
            "message"
        ] = "Sorry: we believe we have received an unreasonably high number of requests of this kind. Please try later"
        return

        # send email
    forward_to_email = webnotes.conn.get_value("Contact Us Settings", None, "forward_to_email")
    if forward_to_email:
        from webnotes.utils.email_lib import sendmail

        sendmail(forward_to_email, sender, message, subject)

    webnotes.response.status = "okay"

    return True
开发者ID:nabinhait,项目名称:frappe,代码行数:33,代码来源:contact.py


示例4: sent_notification

	def sent_notification(self):
		i = {
			'name' : self.doc.name,
			'senders_name': self.doc.allocated_to,
			'opening_date': self.doc.opening_date,
			'exp_start_date': self.doc.exp_start_date,
			'exp_end_date' : self.doc.exp_end_date,
			'subject' : self.doc.subject,
			'project': self.doc.project,
			'review_date': self.doc.review_date,
			'description': self.doc.description
		}

		msg2="""<h2>%(name)s</h2>
			<p>This is a Notification for the task %(name)s that has been assigned to you 
				by %(senders_name)s on %(opening_date)s</p>
			<p><b>Subject:</b> %(subject)s </p>
			<p><b>Project:</b> %(project)s</p>
			<p><b>Review Date:</b> %(review_date)s</p>
			<p><b>Expected Start Date:</b> %(exp_start_date)s</p>
			<p><b>Expected End Date:</b> %(exp_end_date)s</p>
			<p><b>Details:</b> %(description)s</p>
			<p>You will also recieve another reminder 2 days before the commencement of the task</p>
			<p>Good Luck!</p>
			<p>(This notification is autogenerated)</p>""" % i
		sendmail(self.doc.allocated_to, sender='[email protected]', msg=msg2,send_now=1,\
			subject='A task has been assigned')
开发者ID:calvinfroedge,项目名称:erpnext,代码行数:27,代码来源:ticket.py


示例5: send_email_notification

	def send_email_notification(self,doc_type,doc_name):
		""" Notify user about auto creation of indent"""
		
		from webnotes.utils.email_lib import sendmail
		email_list=[d[0] for d in sql("select parent from tabUserRole where role in ('Purchase Manager','Material Manager') and parent not in ('Administrator', 'All', 'Guest')")]
		msg='A Purchase Request has been raised for item %s: %s on %s '%(doc_type, doc_name, nowdate())
		sendmail(email_list, subject='Auto Purchase Request Generation Notification', msg = msg)	
开发者ID:aarohan,项目名称:erpnext,代码行数:7,代码来源:bin.py


示例6: sent_reminder_task

def sent_reminder_task():
	task_list = sql("""
		select subject, allocated_to, project, exp_start_date, exp_end_date,
			priority, status, name, senders_name, opening_date, review_date, description 
		from tabTask
		where task_email_notify=1 
			and sent_reminder=0 
			and status='Open' 
			and exp_start_date is not null""",as_dict=1)
	for i in task_list:		
		if date_diff(i['exp_start_date'],nowdate()) ==2:
			msg2="""<h2>Two days to complete: %(name)s</h2>
			<p>This is a reminder for the task %(name)s has been assigned to you 
				by %(senders_name)s on %(opening_date)s</p>
			<p><b>Subject:</b> %(subject)s </p>
			<p><b>Project:</b> %(project)s</p>
			<p><b>Expected Start Date:</b> %(exp_start_date)s</p>
			<p><b>Expected End Date:</b> %(exp_end_date)s</p>
			<p><b>Review Date:</b> %(review_date)s</p>
			<p><b>Details:</b> %(description)s</p>
			<p>If you have already completed this task, please update the system</p>
			<p>Good Luck!</p>
			<p>(This notification is autogenerated)</p>""" % i
			sendmail(i['allocated_to'], sender='[email protected]', msg=msg2,send_now=1, \
				subject='A task has been assigned')
			sql("update `tabTask` set sent_reminder='1' where name='%(name)s' and allocated_to= '%(allocated_to)s'" % i)	
开发者ID:NorrWing,项目名称:erpnext,代码行数:26,代码来源:project_control.py


示例7: notify

def notify(arg=None):
	from webnotes.utils import cstr
	fn = webnotes.conn.sql('select first_name, last_name from tabProfile where name=%s', webnotes.user.name)[0]
	if fn[0] or f[1]:
		fn = cstr(fn[0]) + (fn[0] and ' ' or '') + cstr(fn[1])
	else:
		fn = webnotes.user.name

	message = '''A new comment has been posted on your page by %s:
	
	<b>Comment:</b> %s
	
	To answer, please login to your erpnext account!
	''' % (fn, arg['txt'])
	
	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 '[email protected]'
	
	from webnotes.utils.email_lib import sendmail
	sendmail([arg['contact']], sender, email_msg, fn + ' has posted a new comment')	
开发者ID:hbkfabio,项目名称:erpnext,代码行数:26,代码来源:messages.py


示例8: send_auto_reply

	def send_auto_reply(self, d):
		"""
			Send auto reply to emails
		"""
		from webnotes.utils import cstr

		signature = self.email_settings.fields.get('support_signature') or ''

		response = self.email_settings.fields.get('support_autoreply') or ("""
A new Ticket has been raised for your query. If you have any additional information, please
reply back to this mail.
		
We will get back to you as soon as possible
----------------------
Original Query:

""" + d.description + "\n----------------------\n" + cstr(signature))

		from webnotes.utils.email_lib import sendmail		
		
		sendmail(\
			recipients = [cstr(d.raised_by)], \
			sender = cstr(self.email_settings.fields.get('support_email')), \
			subject = '['+cstr(d.name)+'] ' + cstr(d.subject), \
			msg = cstr(response))
开发者ID:hbkfabio,项目名称:erpnext,代码行数:25,代码来源:__init__.py


示例9: send_email

	def send_email(self, backup_file):
		"""
			Sends the link to backup file located at erpnext/backups
		"""
		backup_url = webnotes.conn.get_value('Website Settings',
			'Website Settings', 'subdomain') or ''
		backup_url = os.path.join('http://' + backup_url, 'backups')
		file_url = os.path.join(backup_url, backup_file)
		from webnotes.utils.email_lib import sendmail
		
		recipient_list = self.get_recipients()
		msg = """<a href="%(file_url)s">Click here to begin downloading\
		 your backup</a>
		 
		 This link will be valid for 24 hours.
		 
		 Also, a new backup will be available for download (if requested)\
		  only after 24 hours.""" % {"file_url":file_url}
		
		backup_file_path = os.path.join(conf.backup_path, backup_file)
		datetime_str = datetime.fromtimestamp(os.stat(backup_file_path).st_ctime)
		
		subject = datetime_str.strftime("%d/%m/%Y %H:%M:%S") + """ - Backup ready to be downloaded"""
		sendmail(recipients=recipient_list, msg=msg, subject=subject)
		return recipient_list
开发者ID:mehulsbhatt,项目名称:wnframework,代码行数:25,代码来源:backups.py


示例10: post_comment

def post_comment(arg):
	arg = load_json(arg)
	
	from webnotes.model.doc import Document
	d = Document('Comment Widget Record')
	d.comment_doctype = 'My Company'
	d.comment_docname = arg['uid'] # to
	d.owner = webnotes.user.name
	d.comment = arg['comment']
	d.save(1)
	
	if cint(arg['notify']):
		fn = webnotes.conn.sql('select first_name, last_name from tabProfile where name=%s', webnotes.user.name)[0]
		if fn[0] or f[1]:
			fn = cstr(fn[0]) + (fn[0] and ' ' or '') + cstr(fn[1])
		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!
		''' % (fn, arg['comment'])
		
		sendmail([arg['uid']], webnotes.user.name, get_formatted_message('New Comment', message), fn + ' has posted a new comment')
开发者ID:Morphnus-IT-Solutions,项目名称:trimos,代码行数:29,代码来源:my_company.py


示例11: send_email

	def send_email(self):
		"""
			Sends the link to backup file located at erpnext/backups
		"""
		from webnotes.utils.email_lib import sendmail, get_system_managers

		backup_url = webnotes.conn.get_value('Website Settings',
			'Website Settings', 'subdomain') or ''
		backup_url = os.path.join('http://' + backup_url, 'backups')		
		
		recipient_list = get_system_managers()
		
		msg = """<p>Hello,</p>
		<p>Your backups are ready to be downloaded.</p>
		<p>1. <a href="%(db_backup_url)s">Click here to download\
		 the database backup</a></p>
		<p>2. <a href="%(files_backup_url)s">Click here to download\
		the files backup</a></p>
		<p>This link will be valid for 24 hours. A new backup will be available 
		for download only after 24 hours.</p>
		<p>Have a nice day!<br>ERPNext</p>""" % {
			"db_backup_url": os.path.join(backup_url, os.path.basename(self.backup_path_db)),
			"files_backup_url": os.path.join(backup_url, os.path.basename(self.backup_path_files)) 
		}
		
		datetime_str = datetime.fromtimestamp(os.stat(self.backup_path_db).st_ctime)
		subject = datetime_str.strftime("%d/%m/%Y %H:%M:%S") + """ - Backup ready to be downloaded"""
		
		sendmail(recipients=recipient_list, msg=msg, subject=subject)
		return recipient_list
开发者ID:ricardomomm,项目名称:wnframework,代码行数:30,代码来源:backups.py


示例12: 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, get_url(), 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:rajatkapoor,项目名称:erpnext,代码行数:35,代码来源:sales_invoice.py


示例13: send_response

	def send_response(self):
		"""
			Adds a new response to the ticket and sends an email to the sender
		"""
		if not self.doc.new_response:
			webnotes.msgprint("Please write something as a response", raise_exception=1)
		
		subject = '[' + self.doc.name + '] ' + (self.doc.subject or 'No Subject Specified')
		
		response = self.doc.new_response + '\n\n[Please do not change the subject while responding.]'

		# add last response to new response
		response += self.last_response()

		signature = webnotes.conn.get_value('Email Settings',None,'support_signature')
		if signature:
			response += '\n\n' + signature

		from webnotes.utils.email_lib import sendmail
		
		sendmail(\
			recipients = [self.doc.raised_by], \
			sender=webnotes.conn.get_value('Email Settings',None,'support_email'), \
			subject=subject, \
			msg=response)

		self.doc.new_response = None
		webnotes.conn.set(self.doc,'status','Waiting for Customer')
		self.make_response_record(response)
开发者ID:NorrWing,项目名称:erpnext,代码行数:29,代码来源:support_ticket.py


示例14: send

	def send(self):
		"""
			* Execute get method
			* Send email to recipients
		"""
		if not self.doc.recipient_list: return

		self.sending = True
		result, email_body = self.get()
		
		recipient_list = self.doc.recipient_list.split("\n")

		# before sending, check if user is disabled or not
		# do not send if disabled
		profile_list = webnotes.conn.sql("SELECT name, enabled FROM tabProfile", as_dict=1)
		for profile in profile_list:
			if profile['name'] in recipient_list and profile['enabled'] == 0:
				del recipient_list[recipient_list.index(profile['name'])]

		from webnotes.utils.email_lib import sendmail
		try:
			#webnotes.msgprint('in send')
			sendmail(
				recipients=recipient_list,
				sender='[email protected]',
				reply_to='[email protected]',
				subject=self.doc.frequency + ' Digest',
				msg=email_body,
				from_defs=1
			)
		except Exception, e:
			webnotes.msgprint('There was a problem in sending your email. Please contact [email protected]')
			webnotes.errprint(webnotes.getTraceback())
开发者ID:antoxin,项目名称:erpnext,代码行数:33,代码来源:email_digest.py


示例15: send_email

  def send_email(self):
    if not self.doc.email_body:
       msgprint("Please enter message before sending")

    else:
      receiver_list = self.get_receiver_nos()
      if receiver_list:
        from webnotes.utils.email_lib import sendmail
        sendmail(receiver_list, subject=self.doc.subject, msg = self.doc.email_body)
开发者ID:Tejal011089,项目名称:Medsyn2_app,代码行数:9,代码来源:sms_center.py


示例16: on_update

	def on_update(self):
		clear_unit_views(self.doc.unit)

		if self.doc.assigned_to and self.doc.assigned_to != self.assigned_to \
			and webnotes.session.user != self.doc.assigned_to:
			
			# send assignment email
			sendmail(recipients=[self.doc.assigned_to], 
				subject="You have been assigned this Task by {}".format(get_fullname(self.doc.modified_by)),
				msg=self.get_reply_email_message(get_fullname(self.doc.owner)))
开发者ID:butu5,项目名称:aapkamanch,代码行数:10,代码来源:post.py


示例17: on_update

	def on_update(self):
		clear_cache(website_group=self.doc.website_group)
		clear_post_cache(self.doc.parent_post or self.doc.name)

		if self.doc.assigned_to and self.doc.assigned_to != self.assigned_to \
			and webnotes.session.user != self.doc.assigned_to:
			
			# send assignment email
			sendmail(recipients=[self.doc.assigned_to], 
				subject="You have been assigned this Task by {}".format(get_fullname(self.doc.modified_by)),
				msg=self.get_reply_email_message(self.doc.name, get_fullname(self.doc.owner)))
开发者ID:bindscha,项目名称:wnframework_old,代码行数:11,代码来源:post.py


示例18: send_email_notification

	def send_email_notification(self, doc_type, doc_name):
		""" Notify user about auto creation of indent"""
		
		from webnotes.utils.email_lib import sendmail
		email_list=[d[0] for d in sql("""select distinct r.parent from tabUserRole r, tabProfile p
			where p.name = r.parent and p.enabled = 1 and p.docstatus < 2
			and r.role in ('Purchase Manager','Material Manager') 
			and p.name not in ('Administrator', 'All', 'Guest')""")]
		msg="""A Purchase Request has been raised 
			for item %s: %s on %s """ % (doc_type, doc_name, nowdate())
		sendmail(email_list, subject='Auto Purchase Request Generation Notification', msg = msg)	
开发者ID:trycatcher,项目名称:erpnext,代码行数:11,代码来源:bin.py


示例19: send

	def send(self):
		# send email only to enabled users
		valid_users = [p[0] for p in webnotes.conn.sql("""select name from `tabProfile`
			where enabled=1""")]
		recipients = filter(lambda r: r in valid_users,
			self.doc.recipient_list.split("\n"))
		
		from webnotes.utils.email_lib import sendmail
		sendmail(recipients=recipients, subject=(self.doc.frequency + " Digest"),
			sender="ERPNext Notifications <[email protected]>",
			msg=self.get_digest_msg())
开发者ID:trycatcher,项目名称:erpnext,代码行数:11,代码来源:email_digest.py


示例20: update_password

	def update_password(self):
		from webnotes.utils.email_lib import sendmail
		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.
		
- %s
''' % (self.doc.name, self.doc.modified_by)
		sendmail([self.doc.email], subject='Change of Password Notification', parts = [('text/plain', email_text)])
		msgprint("Your password has been changed")
开发者ID:Vichagserp,项目名称:cimworks,代码行数:11,代码来源:profile.py



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
Python file_manager.get_file函数代码示例发布时间:2022-05-26
下一篇:
Python utils.validate_email_add函数代码示例发布时间: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