示例#1
0
def send_event_digest():
    today = nowdate()
    for user in webnotes.conn.sql("""select name, email, language 
		from tabProfile where ifnull(enabled,0)=1 
		and user_type='System User' and name not in ('Guest', 'Administrator')""",
                                  as_dict=1):
        events = get_events(today, today, user.name, for_reminder=True)
        if events:
            text = ""
            webnotes.set_user_lang(user.name, user.language)
            webnotes.load_translations("core", "doctype", "event")

            text = "<h3>" + webnotes._("Events In Today's Calendar") + "</h3>"
            for e in events:
                if e.all_day:
                    e.starts_on = "All Day"
                text += "<h4>%(starts_on)s: %(subject)s</h4><p>%(description)s</p>" % e

            text += '<p style="color: #888; font-size: 80%; margin-top: 20px; padding-top: 10px; border-top: 1px solid #eee;">'\
             + webnotes._("Daily Event Digest is sent for Calendar Events where reminders are set.")+'</p>'

            from webnotes.utils.email_lib import sendmail
            sendmail(recipients=user.email,
                     subject=webnotes._("Upcoming Events for Today"),
                     msg=text)
示例#2
0
def send_event_digest():
	today = nowdate()
	for user in webnotes.conn.sql("""select name, email, language 
		from tabProfile where ifnull(enabled,0)=1 
		and user_type='System User' and name not in ('Guest', 'Administrator')""", as_dict=1):
		events = get_events(today, today, user.name, for_reminder=True)
		if events:
			text = ""
			webnotes.set_user_lang(user.name, user.language)
			webnotes.load_translations("core", "doctype", "event")

			text = "<h3>" + webnotes._("Events In Today's Calendar") + "</h3>"
			for e in events:
				if e.all_day:
					e.starts_on = "All Day"
				text += "<h4>%(starts_on)s: %(subject)s</h4><p>%(description)s</p>" % e

			text += '<p style="color: #888; font-size: 80%; margin-top: 20px; padding-top: 10px; border-top: 1px solid #eee;">'\
				+ webnotes._("Daily Event Digest is sent for Calendar Events where reminders are set.")+'</p>'

			from webnotes.utils.email_lib import sendmail
			sendmail(recipients=user.email, subject=webnotes._("Upcoming Events for Today"),
				msg = text)