def send_mux_mail(emailColl,verbose=False,debug=False,**kwargs): for cur in emailColl.find({'sender':{'$exists':'true'}}).limit(1): if verbose: print "Found email handler:",cur['sender'] gmail_user = cur['sender'] gmail_pwd = cur['pass'] p=Preferences() emailMap = p.getEmailFileMapping(emailColl) for key in emailMap.keys(): files = [curFile for curFile in [directory+curFilename for curFilename in emailMap[key][p.attachments]]] dest=emailMap[key][p.emailArray] if verbose: print "\tTo:",dest if verbose: print "\tFiles:",files #msg="Hey,\nLast night there was an issue with (only) Avacyn Restored data for SCG. I'm re-sending the emails as there were a couple big moves from SCG on prices. Sorry for any inconvenience." msg="\nHey, these are the price changes from the last 24 hours. Let me at know at [email protected] if you have any questions, comments or requests." msg+="\n\nDon't forget; you can set your store and format preferences on the website now." subject="Hello from magicItch",str(date.today()) send_report_email(gmail_user=gmail_user, gmail_pwd=gmail_pwd, recipients=dest, subject=subject, text_body=msg, attachment_paths=files) #mail(dest, subject, msg, files) time.sleep(2)
def auto_alert_handler(processName, **varargs): send_report_email("MagicItch Error:"+processName,'\n'.join([`k`+'||'+`v` for k,v in varargs.iteritems()]))