def sendTmpl(self, qTemplate = '', mainTable = '', qSuperSearch = '', toaddr = [], lang = ''): # Make instance of email mail = misc.email() # Make instance of dTP d = dtp.dTP(lang) d.dTLtmpl.resetLoadedModules() # Process template d.dTLtmpl.qVars['qTemplate'] = qTemplate d.setMainTable(mainTable) d.dTLtmpl.qVars['qSuperSearch'] = qSuperSearch d.go(script = 1) try: # Send mail mail.sendFileAsMail(fromaddr = self.cp.get('Basket', 'from'), toaddr = toaddr, file = d.fdoutName) # Log self.log.write('SENDING EMAIL TEMPLATE (%s)%s TO %s' % (lang, qTemplate, toaddr), printLevel = 1) # Remove temporary file os.remove(d.fdoutName) # Any error except: # Log self.log.write('ERROR SENDING MAIL: %s(%s)' % (sys.exc_info()[0], sys.exc_info()[1]), printLevel = 1) # Delete instance del d
def __init__(self): # Call constructor of class aDS aDataStruct.aDS.__init__(self) # Make instance of misc.TIME self.TIME = misc.TIME() # Make instance of misc.email self.email = misc.email() # Get actual timestamp self.timeNow = time.time()
def __init__(self): # Call constructor of aDS aDataStruct.aDS.__init__(self) # Check session self.checkSession(SessionMustExist=1, SessionMustBeAuthorized=1) # Call constructor of class dTP self.__dtp = dtp.dTP() # Make instance of misc.email self.email = misc.email() # Set timestamp of 'now' self.timeNow = time.time()
def sendPasswd(self, qLoginField = 'Login', qLogin = ''): try: # Get email address and password from database stmt = 'SELECT ID FROM Kunde WHERE %s = "%s"' % (qLoginField, qLogin) rowCount = self.SQLAL.query(stmt) # Did we receive an result? if not rowCount: # Go back return self.sendPasswdErrorURL # Fetch result result = self.SQLAL.fetchall() # Make instance of 'email' email = misc.email() except: # Log and return failURL self.log.write('%s(%s) CAN\'T SEND PASSWORD BY EMAIL' % (sys.exc_info()[0], sys.exc_info()[1]), printLevel = 1) return self.failURL # Process template self.dtp.dTLtmpl.qVars['qTemplate'] = 'email,register' self.dtp.setMainTable('Kunde') self.dtp.dTLtmpl.qVars['qSuperSearch'] = 'ID*%i' % result[0][0] self.dtp.go(script = 1) try: # Send mail email.sendFileAsMail(fromaddr = self.cp.get('email', 'from'), toaddr = [qLogin,], file = self.dtp.fdoutName) # Log self.log.write('SENDING EMAIL TEMPLATE email,register TO %s' % qLogin, printLevel = 1) # Remove temporary file os.remove(self.dtp.fdoutName) # Go to OK URL return self.sendPasswdOKURL # Any error except: # Log self.log.write('ERROR SENDING MAIL: %s(%s)' % (sys.exc_info()[0], sys.exc_info()[1]), printLevel = 1) # Go back return self.sendPasswdErrorURL
bond_raw = bond_raw(bond_url) bond_high = bond_high(bond_raw, user_profit) bond_max = bond_max(bond_high) print_bond(bond_high, bond_max) etf = etf(etf_url) print_etf(etf) fj = fj(fj_url) print_fj(fj) kzj = kzj(kzj_url) print_kzj(kzj) indice_dt_update = indice() indice_filter = indice_filter(indice_dt_update, 25) print_indice(indice_dt_update, indice_filter) funda_raw = funda_raw(funda_url) funda = funda(funda_raw, 10, 5, 0) print_funda(funda) html_end() #邮件 title = '今日PMONEY金融 (为了%s定制),(债券最高收益:%s)' % (user_name, bond_max) if len(bond_high) !=0: print 'Meet bond value to send email' email(True, title, user_email)
replace_dict['bk_pg3']=funda_str replace_dict['bk_title4']=kzj_title replace_dict['bk_pg4']=kzj_str replace_dict['bk_title5']=bond_title replace_dict['bk_pg5']=bond_str replace_dict['bk_title6']=fj_title replace_dict['bk_pg6']=fj_str replace_dict['bk_title7']=stock_title replace_dict['bk_pg7']=stock_str replace_dict['bk_title1']=etf_title replace_dict['bk_pg1']=etf_str #replace_dict['bk_title2']=indice_title #replace_dict['bk_pg2']=indice_str replace_html(f, fn, replace_dict) #邮件 title = '今日PMONEY金融 (为了%s定制),(债券最高收益:%s)' % (user_name, bond_max) if len(bond_high) !=0: print 'Meet bond value to send email' email(True, title, user_email, web_url)
bond_raw = bond_raw(bond_url) bond_high = bond_high(bond_raw, user_profit) bond_max = bond_max(bond_high) print_bond(bond_high, bond_max) etf = etf(etf_url) print_etf(etf) fj = fj(fj_url) print_fj(fj) kzj = kzj(kzj_url) print_kzj(kzj) indice_dt_update = indice() indice_filter = indice_filter(indice_dt_update, 25) print_indice(indice_dt_update, indice_filter) funda_raw = funda_raw(funda_url) funda = funda(funda_raw, 10, 5, 0) print_funda(funda) html_end() #邮件 title = '今日PMONEY金融 (为了%s定制),(债券最高收益:%s)' % (user_name, bond_max) if len(bond_high) != 0: print 'Meet bond value to send email' email(True, title, user_email)