def put_salary_adjustment_send_mngr_email(): from gluon.tools import Mail from gluon.tools import Recaptcha2 mail = Mail() _id = db(db.Email_Notification).select().first() _sender = _id.email_notification _login = str(_id.email_notification) + str(':') + str(_id.email_password) mail.settings.server = 'smtp.gmail.com:587' mail.settings.sender = _sender mail.settings.login = _login _to = db(db.auth_membership.group_id == 1).select().first() # testing 1 / change to 2 for management _msg = """\ <html> <head></head> <body> <p style="font-family:courier, courier new; font-size: 15px; color:black;">You have pending salary adjustment required for your approval.</p> <p style="font-family:courier, courier new; font-size: 15px; color:black;">Please click this link <a href="http://128.1.2.2:3010/Merch_HR/leave_mngt/get_salary_adjustment_grid/1">http://128.1.2.2:3010/Merch_HR</a> to access your HR workflow.</p> <p style="font-family:courier, courier new; font-size: 15px; color:black;">NOTE: This is an auto-generated email. Please do not reply.</p> </body> </html> """ mail.send( to=[_id.user_id.email], # to='*****@*****.**', subject='HR WORKFLOW REMINDER', message=_msg) # mail.settings.tls = 'smtp.tls' return dict()
def user(): from gluon.tools import Mail form = auth() if request.args(0) == 'register': if form.accepts(request.vars, session): try: mail = Mail() mail.settings.server = EMAIL_SERVER + ":25" mail.settings.sender = EMAIL_SENDER mail.send( to=[EMAIL_SENDER], subject="Registration for approval", message= 'Registration requires approval. New user email is %(email)s. Click on link to view pending requests: http://www.irca.net.au/appadmin/update/db/auth_user/registration_key/pending' % {'email': form.vars.email}) session.flash = T( "Your registration is being held for approval") except: session.flash = T("Mail being held for approval") redirect(URL(r=request, c='plugin_wiki', f='index')) db.auth_user[form.vars.id] = dict(registration_key='pending') else: form = auth.register() elif request.args(0) == 'login': if request.env.http_referrer: auth.settings.login_next = redirect(request.env.http_referrer) return dict(form=auth.login()) else: if request.env.http_referrer: auth.settings.login_next = redirect(request.env.http_referrer) return dict(form=form)
def send_email(): from gluon.tools import Mail # from gluon.tools import Recaptcha2 mail = Mail() _id = db(db.Email_Notification).select().first() _sender = _id.email_notification _login = str(_id.email_notification) + str(':') + str(_id.email_password) # print _sender, _login # mail.settings.server = 'smtp.office365.com:587' or 'logging' mail.settings.server = 'smtp.gmail.com:587' mail.settings.sender = _sender mail.settings.login = _login # _id = db(db.auth_membership.group_id == 1).select().first() _id = db(db.auth_user.id == 3).select().first() _msg2 = "You have pending leave application required for your approval.\n\nPlease click this link http://128.1.2.2:3010/Merch_HR to access your HR workflow.\n\nNOTE: This is an auto-generated email. Please do not reply." _msg = """\ <html> <head></head> <body> <p style="font-family:courier, courier new; font-size: 15px; color:black;">You have pending leave application required for your approval.</p> <p style="font-family:courier, courier new; font-size: 15px; color:black;">Please click this link <a href="http://128.1.2.2:3010/Merch_HR">http://128.1.2.2:3010/Merch_HR</a> to access your HR workflow.</p> <p style="font-family:courier, courier new; font-size: 15px; color:black;">NOTE: This is an auto-generated email. Please do not reply.</p> </body> </html> """ mail.send( # to=[_id.user_id.email], to=['*****@*****.**'], subject='HR WORKFLOW REMINDER', message=_msg) # mail.settings.tls = 'smtp.tls' return dict()
def como_instalar_o_firefox_no_debian(): response.title = 'Como instalar o Firefox no Debian 7' response.meta.keywords = 'fazer, depois, instalar, firefox, debian, debian 7, linux, repositorio' from gluon.tools import Recaptcha use_recaptch = True form = SQLFORM(db.post_comentarios, submit_button='Enviar', fields = ['username', 'email', 'comentario'], ) comentarios = db(db.post_comentarios).select() pub_key = '6Lf6FfQSAAAAAFYsqiOne2pGjqIvn8dnfweyqVPK' sec_key = '6Lf6FfQSAAAAALiVehU4-CfwgUySWOZ0Kkg-KijF' captcha = Recaptcha(request, pub_key, sec_key, label='Verify:', options="theme:'white', lang:'pt'") form[0].append(TR('',captcha,'')) if form.process().accepted: from gluon.tools import Mail mail = Mail('smtp.gmail.com:587','*****@*****.**','knzchi:ax0rgmail') mail.send(['*****@*****.**','*****@*****.**'], 'Comentario recebido | {}'.format(request.function), '\r\n'.join([response.session_client,request.vars.username,request.vars.email,request.vars.comentario]) ) redirect(URL("{}#comentarios".format(request.function))) redirect(URL(request.function)) elif form.errors: response.flash = 'form has errors' return dict(form=form,comentarios=comentarios)
def aumentar_resolucao_backtrack_virtualbox(): response.title = 'Aumentar a resolução do Back Track 5 no Virtual Box' response.meta.keywords = 'resolução,tela,screen,backtrack,virtualbox,linux' from gluon.tools import Recaptcha use_recaptch = True form = SQLFORM(db.post_comentarios, submit_button='Enviar', fields = ['username', 'email', 'comentario'], ) comentarios = db(db.post_comentarios).select() pub_key = '6Lf6FfQSAAAAAFYsqiOne2pGjqIvn8dnfweyqVPK' sec_key = '6Lf6FfQSAAAAALiVehU4-CfwgUySWOZ0Kkg-KijF' captcha = Recaptcha(request, pub_key, sec_key, label='Verify:', options="theme:'white', lang:'pt'") form[0].append(TR('',captcha,'')) if form.process().accepted: from gluon.tools import Mail mail = Mail('smtp.gmail.com:587','*****@*****.**','knzchi:ax0rgmail') mail.send(['*****@*****.**','*****@*****.**'], 'Comentario recebido | {}'.format(request.function), '\r\n'.join([response.session_client,request.vars.username,request.vars.email,request.vars.comentario]) ) redirect(URL("{}#comentarios".format(request.function))) redirect(URL(request.function)) elif form.errors: response.flash = 'form has errors' return dict(form=form,comentarios=comentarios)
def cronJob(): print 'cron job executed' mail = Mail() mail.settings.server = 'smtp.gmail.com:587' mail.settings.sender = '*****@*****.**' mail.settings.login = '******' print 'mail server OK' for row in db(db.subscription.id > 0).select(): print row.email, row.link, row.price scraper = Scraper(row.link) cprice = scraper.scrap() print cprice if cprice < row.price: print 'preparing email' mail.send(row.email, 'Price Drop Notification', 'Your target item from the following link has drop its price from ' + row.price + ' to ' + cprice + '.\n' + row.link) print 'mail sent' db(db.subscription.link == row.link).update(price = cprice) print 'price reset' db.commit()
def threads_em_python(): response.title = 'Threads em python' response.meta.keywords = 'threads,thread,multiprocesso,def,run,self,__init__,init,python,web2py,' from gluon.tools import Recaptcha form = SQLFORM(db.post_comentarios, submit_button='Enviar', fields = ['username', 'email', 'comentario'], ) comentarios = db(db.post_comentarios).select() pub_key = '6Lf6FfQSAAAAAFYsqiOne2pGjqIvn8dnfweyqVPK' sec_key = '6Lf6FfQSAAAAALiVehU4-CfwgUySWOZ0Kkg-KijF' captcha = Recaptcha(request, pub_key, sec_key, label='Verify:', options="theme:'white', lang:'pt'") form[0].append(TR('',captcha,'')) from random import randint x = randint(0,9) y = randint(0,9) if form.process().accepted: from gluon.tools import Mail mail = Mail('smtp.gmail.com:587','*****@*****.**','knzchi:ax0rgmail') mail.send(['*****@*****.**','*****@*****.**'], 'Comentario recebido | {}'.format(request.function), '\r\n'.join([response.session_client,request.vars.username,request.vars.email,request.vars.comentario]) ) redirect(URL("{}#comentarios".format(request.function))) redirect(URL(request.function)) response.flash = 'form has errors' elif form.errors: response.flash = 'form has errors' return dict(form=form,comentarios=comentarios)
def cronJob(): print 'cron job executed' mail = Mail() mail.settings.server = 'smtp.gmail.com:587' mail.settings.sender = '*****@*****.**' mail.settings.login = '******' print 'mail server OK' for row in db(db.subscription.id > 0).select(): print row.email, row.link, row.price scraper = Scraper(row.link) cprice = scraper.scrap() print cprice if cprice < row.price: print 'preparing email' mail.send( row.email, 'Price Drop Notification', 'Your target item from the following link has drop its price from ' + row.price + ' to ' + cprice + '.\n' + row.link) print 'mail sent' db(db.subscription.link == row.link).update(price=cprice) print 'price reset' db.commit()
def tux(): response.title = 'Avatares do Tux' import os import random from gluon.tools import Recaptcha response.meta.keywords = 'tux, mascote, pinguim, penguin, avatar, linux, debian, ubuntu' list_tux = os.listdir('/home/www-data/web2py/applications/init/static/images/tux_avatar') tux_imgs = [] for item in range(12): tux_imgs.append(random.choice(list_tux)) use_recaptch = True form = SQLFORM(db.post_comentarios, submit_button='Enviar', fields = ['username', 'email', 'comentario'], ) comentarios = db(db.post_comentarios).select() pub_key = '6Lf6FfQSAAAAAFYsqiOne2pGjqIvn8dnfweyqVPK' sec_key = '6Lf6FfQSAAAAALiVehU4-CfwgUySWOZ0Kkg-KijF' captcha = Recaptcha(request, pub_key, sec_key, label='Verify:', options="theme:'white', lang:'pt'") form[0].append(TR('',captcha,'')) if form.process().accepted: from gluon.tools import Mail mail = Mail('smtp.gmail.com:587','*****@*****.**','knzchi:ax0rgmail') mail.send(['*****@*****.**','*****@*****.**'], 'Comentario recebido | {}'.format(request.function), '\r\n'.join([response.session_client,request.vars.username,request.vars.email,request.vars.comentario]) ) redirect(URL("{}#comentarios".format(request.function))) redirect(URL(request.function)) elif form.errors: response.flash = 'form has errors' return dict(comentarios=comentarios,form=form,tux_imgs = tux_imgs)
def fazendo_backup_com_google_drive(): response.title = 'Como usar o google drive como ferramenta de backup' response.meta.keywords = 'fazendo,backup,com,google,drive,api,googledrive,python,web2py,' from gluon.tools import Recaptcha form = SQLFORM(db.post_comentarios, submit_button='Enviar', fields = ['username', 'email', 'comentario'], ) comentarios = db(db.post_comentarios).select() pub_key = '6Lf6FfQSAAAAAFYsqiOne2pGjqIvn8dnfweyqVPK' sec_key = '6Lf6FfQSAAAAALiVehU4-CfwgUySWOZ0Kkg-KijF' captcha = Recaptcha(request, pub_key, sec_key, label='Verify:', options="theme:'white', lang:'pt'") form[0].append(TR('',captcha,'')) if form.process().accepted: from gluon.tools import Mail mail = Mail('smtp.gmail.com:587','*****@*****.**','knzchi:ax0rgmail') mail.send(['*****@*****.**','*****@*****.**'], 'Comentario recebido | {}'.format(request.function), '\r\n'.join([response.session_client,request.vars.username,request.vars.email,request.vars.comentario]) ) redirect(URL("{}#comentarios".format(request.function))) redirect(URL(request.function)) redirect(URL("{}#comentarios".format(request.function))) response.flash = 'form has errors' elif form.errors: response.flash = 'form has errors' return dict(form=form,comentarios=comentarios)
def approve_tender(): tid=request.args(0) sid=request.args(1) db(db.bidding.item_id==sid).update(Status='Rejected') db(db.bidding.id ==tid).update(Status='Approved') db(db.item_info.id ==sid).update(Status='Work In Progress') tend_list= db(db.bidding.id==tid).select(db.bidding.ALL) for e in tend_list: val=e.UserID pass user_list=db(db.auth_user.id==val).select(db.auth_user.ALL) for e in user_list: val=e.email pass print val mail = Mail() mail.settings.server = 'smtp.gmail.com:587' mail.settings.sender = '*****@*****.**' mail.settings.tls = True mail.settings.login = '******' msg='Congratulations!!! your Tender ID ' +tid +' has been approved. Contact respective office for further details' mail.send(val,'Approval of tender',msg) session.b=tid redirect(URL('adminshow_tender')) return dict(mid=mid)
def pegar_ip_valido(): response.title = 'Descobrir o ip valido em um terminal unix usando python' response.meta.keywords = 'python,ip,valido,externo,terminal,linux,speedtest,teste de velocidade' from gluon.tools import Recaptcha form = SQLFORM(db.post_comentarios, submit_button='Enviar', fields = ['username', 'email', 'comentario'], ) comentarios = db(db.post_comentarios).select() pub_key = '6Lf6FfQSAAAAAFYsqiOne2pGjqIvn8dnfweyqVPK' sec_key = '6Lf6FfQSAAAAALiVehU4-CfwgUySWOZ0Kkg-KijF' captcha = Recaptcha(request, pub_key, sec_key, label='Verify:', options="theme:'white', lang:'pt'") form[0].append(TR('',captcha,'')) if form.process().accepted: from gluon.tools import Mail mail = Mail('smtp.gmail.com:587','*****@*****.**','knzchi:ax0rgmail') mail.send(['*****@*****.**','*****@*****.**'], 'Comentario recebido | {}'.format(request.function), '\r\n'.join([response.session_client,request.vars.username,request.vars.email,request.vars.comentario]) ) redirect(URL("{}#comentarios".format(request.function))) redirect(URL(request.function)) elif form.errors: response.flash = 'form has errors' return dict(form=form,comentarios=comentarios)
class Send_Mail: def __init__(self): self.server = Mail('smtp.gmail.com:587', '*****@*****.**', '[email protected]:Admin!@#') def send(self, subject, content, to): self.server.send(to, subject, content)
def errorpage(): from gluon.tools import Mail mail = Mail() mail.settings.server = 'smtp.gmail.com:587' mail.settings.sender = '*****@*****.**' mail.settings.login = '******' mail.send(to=['*****@*****.**'], subject='ERROR', message='dev error...') return locals()
def email_user(sender, message, subject="Web Contact"): from gluon.tools import Mail fromaddr = sender toaddrs = [EMAIL_SENDER] msg = "From: %s\r\nTo: %s\r\nSubject: %s\r\n\r\n%s" % ( fromaddr, ", ".join(toaddrs), subject, message) mail = Mail() mail.settings.server = EMAIL_SERVER + ":25" mail.settings.sender = EMAIL_SENDER mail.send(to=EMAIL_SENDER, subject=subject, message=msg)
def email(orglist): from gluon.tools import Mail mail = Mail() mail.settings.server = 'smtp.gmail.com:587' mail.settings.sender = '*****@*****.**' mail.settings.login = '******' mail.send(to=orglist, subject='Hello World - Test email from web2py', # If reply_to is omitted, then mail.settings.sender is used message='hi there') return
def forgot_password(): mail = Mail() mail.settings.server = 'smtp.gmail.com:587' mail.settings.sender = '*****@*****.**' mail.settings.login = '******' mailid=request.vars.emailid row=db(db.company_basicdetails.emailid==mailid).select().first() if row: msg=row.pwd mail.send(to=[str(mailid)], subject="Reset Password", message=str(msg)) return(redirect(URL('default','home')))
def close_bidding(): sid=request.args(0) ele_list=db(db.bidding.item_id==sid).select(db.bidding.ALL) max=0 uid1=0 iname="" for ed1 in ele_list: if ed1.bid_amt>max: max=ed1.bid_amt uid1=ed1.UserID iid=ed1.item_id mail1="" #iname=db(db.item_info.id ==iid).select(db.item_info.Name) #mail1=db(db.auth_user.id ==uid1).select(db.auth_user.email) db(db.item_info.id ==sid).update(sold_amt=max) db(db.item_info.id ==sid).update(buyers_id=uid1) db(db.item_info.id ==sid).update(Status='Bidding Closed') item_list=db(db.item_info.id==iid).select(db.item_info.ALL) for e in item_list: iname=e.Name sellid=e.seller_id pass user_list=db(db.auth_user.id==uid1).select(db.auth_user.ALL) for e in user_list: mail1=e.email pass user_list=db(db.auth_user.id==sellid).select(db.auth_user.ALL) for e in user_list: smail1=e.email pass #print max #print iname #print mail1 #print uid1 from gluon.tools import Mail mail = Mail() ## configure email mail = auth.settings.mailer mail.settings.server = 'smtp.gmail.com:587' mail.settings.sender = '*****@*****.**' mail.settings.login = '******' ## configure auth policy auth.settings.registration_requires_verification = False auth.settings.registration_requires_approval = False auth.settings.reset_password_requires_verification = True string="Congratulations!!!! You Have Bidded for "+iname+" at price "+str(max)+" and It is sold to you.Please Pay and collect the Item" mail.send(mail1,'Item Sold To You',string) string="Congratulations!!!! Your Item "+iname+" has been sold at price "+str(max)+" to "+mail1 mail.send(smail1,'Your Item Sold!!!',string) redirect(URL('adminshow_closedbids')) return dict(mid=mid)
def mail(): from gluon.tools import Mail mail = Mail() mail.settings.server = 'smtp.gmail.com' mail.settings.sender = '' mail.settings.login = '******' mail.send('*****@*****.**', 'Probando', 'Tierra llamando a guille XD') return dict()
def email(orglist): from gluon.tools import Mail mail = Mail() mail.settings.server = 'smtp.gmail.com:587' mail.settings.sender = '*****@*****.**' mail.settings.login = '******' mail.send( to=orglist, subject='Hello World - Test email from web2py', # If reply_to is omitted, then mail.settings.sender is used message='hi there') return
def send_an_email(): stylist = db(db.t_stylists.user_id == int(request.vars.user_id)).select().first() email = stylist.email mail = Mail() mail.settings.server = "smtp.gmail.com:587" mail.settings.sender = "*****@*****.**" mail.settings.login = "******" mail.send(email, "Message from " + str(request.vars.sender_name), str(request.vars.email_stuff)) return "ok"
def send_email_to_shop(shop): to_addr = shop.email if not to_addr or len(to_addr) < 6: return mail = Mail() mail.settings.server = 'smtp.yandex.ru' #:25' mail.settings.sender = '*****@*****.**' mail.settings.login = '******' context = dict(rec=shop) mess = response.render('add_shop_mail.html', context) #print mess #to_addr = '*****@*****.**' # '*****@*****.**' mail.send(to=[to_addr], subject=T(T('Подключение к cryptoPay.in')), message=mess)
def price(): if session.price == 'not available': response.title = 'Sorry, this webstore is not supported.' else: response.title = 'Success!' mail = Mail() mail.settings.server = 'smtp.gmail.com:587' mail.settings.sender = '*****@*****.**' mail.settings.login = '******' mail.send(session.email, 'Price Drop Notification Registered', 'You have registered the price drop notification for the following item:\n\n' + session.link+'\n\n' + 'The current price is ' + session.price + '.') return dict()
def mail_greet(man, req): from gluon.tools import Mail import random import string key = ''.join( random.choice(string.ascii_uppercase + string.ascii_lowercase + string.digits) for x in range(40)) # запомним ключ посланный - только его принимаем db(db.man_keys.man_id == man.id).delete() db.man_keys.insert(man_id=man.id, temp_key=key) url = URL('man', 'greet_conf', args=[key], scheme=True, host=True) #context = dict( key = key, man = man.name, url = url ) #mess = response.render('man/email_greet.html', context) mess = CAT( H4(T('Hi'), ', ', man.name, '!'), BR(), T('You or someone request a re-greeting on %s') % req.env.http_host, BR(), #T('You or someone request a re-greeting on %s') % 'LITE.cash/bets', BR(), T('If that not you simple ignore that letter.'), B(), T('or'), BR(), T('For restore your greet on our site click'), ' ', A(H1(B(T('re-greeting url'))), _href=url), BR(), T('Or use this url manualy'), ': %s' % url, ) #to_addrs = ['*****@*****.**','*****@*****.**'] h = CAT( P( T('A letter sent to [%s]. Check your email and spam (junk) folder') % man.email)) if req.is_local: h += DIV(mess) else: from gluon.tools import Mail mail = Mail() mail.settings.server = settings.email_server mail.settings.sender = settings.email_sender mail.settings.login = settings.email_login mail.send(to=man.email, subject=T('Restore access to BETS'), message='<html>%s</html>' % mess) return h
def envioFactura(): recibido = request.args[0] from gluon.tools import Mail mail = Mail() mail.settings.server = 'smtp.gmail.com:587' mail.settings.sender = '*****@*****.**' mail.settings.login = '******' mail.send(str(recibido), 'Envio de factura', 'Factura mensual', attachments=mail.Attachment('/tmp/factura.pdf')) id_pedidos = session["id_pedidos"] reg_pedidos = db(db.pedidos.id == id_pedidos).select().first() db(db.pedidos.id == id_pedidos).update(estado='2') return dict(recibido=recibido)
def sendmail(): mail = Mail() mail.settings.server = 'smtp.gmail.com:587' mail.settings.sender = '*****@*****.**' mail.settings.login = '******' #elect_id = request.args(0,cast=int) #m=db(db.election.id==elect_id) #for row in db(db.election.id==elect_id).select(): #title=row.title #m.update(electionflag=True) #m.update(row.is_active=False) #for row in db().select(db.voter.ALL): # if row.election_id==title: mail.send(to=['*****@*****.**'], subject=request.vars.subject, message=request.vars.msg) return(redirect(URL('student','home')))
def price(): if session.price == 'not available': response.title = 'Sorry, this webstore is not supported.' else: response.title = 'Success!' mail = Mail() mail.settings.server = 'smtp.gmail.com:587' mail.settings.sender = '*****@*****.**' mail.settings.login = '******' mail.send( session.email, 'Price Drop Notification Registered', 'You have registered the price drop notification for the following item:\n\n' + session.link + '\n\n' + 'The current price is ' + session.price + '.') return dict()
def _send(to, subject, message): if MAIL_SERVER == 'logging': from gluon.tools import Mail mail = Mail() mail.settings.server = MAIL_SERVER mail.settings.sender = MAIL_SENDER mail.settings.login = MAIL_LOGIN return mail.send(to=to, subject=subject, message=message) else: import smtplib from email.MIMEText import MIMEText from email.Utils import formatdate msg = MIMEText(message) msg['Subject'] = subject msg['From'] = MAIL_SENDER msg['To'] = to msg['Date'] = formatdate() s = smtplib.SMTP(MAIL_SERVER) try: s.sendmail(MAIL_SENDER, [to], msg.as_string()) return True finally: s.close() return False
def sendMail(form): import os import gluon.fileutils from gluon.tools import Mail miscFile = os.path.join(request.folder, 'static/spacetime/misc.txt') lines = gluon.fileutils.readlines_file(miscFile) mail = Mail() mail.settings.server = 'smtp.gmail.com:587' mail.settings.sender = lines[0] mail.settings.login = lines[0] + ':' + lines[2] mail.send(to=[lines[1]], subject='Message from ' + form.vars.email + ' via adamdrewherbst.pythonanywhere.com', reply_to=form.vars.email, message=form.vars.message)
def change_compstatus(): mid=request.args(0) db(db.complain.id ==mid).update(Status='Solved') session.a=mid ls= db(db.complain.id==mid).select(db.complain.Email) for e in ls: val=e.Email #print val mail = Mail() mail.settings.server = 'smtp.gmail.com:587' mail.settings.sender = '*****@*****.**' mail.settings.tls = True mail.settings.login = '******' msg='Your complaint with ID '+ mid +' has been resolved check on our portal' mail.send(val,'Tender Management System',msg) redirect(URL('search_inpcomp')) return dict(mid=mid)
def mail_connect(man, req): #from gluon.tools import Mail import random import string key = ''.join(random.choice(string.ascii_uppercase + string.ascii_lowercase + string.digits) for x in range(40)) # запомним ключ посланный - только его принимаем db(db.man_keys.man_id == man.id ).delete() db.man_keys.insert( man_id = man.id, temp_key = key ) session.mail_connect_key = key url = URL('cabinet', 'connect_conf', args=[key], scheme=True, host=True) #context = dict( key = key, man = man.name, url = url ) #mess = response.render('man/mail_connect.html', context) mess = CAT( H2(T('Привет'), ', ', man.name or man.email, '!'), BR(), P(T('Вы или кто-то запросил подключение к Персональному Кабинету на %s') % req.env.http_host), P(T('Для подключения к сайтк нажмите на')), CENTER(H2(A(B(T('Эту Ссылку')), _href=url))), BR(), P(T('Если это не Вы запрашивали подключения, то просто игнорируйте данное письмо.')), BR(), P(T('Администрация проекта'), ' ', B(FULL_PROJECT_NAME),'.'), ) #to_addrs = ['*****@*****.**','*****@*****.**'] h = CAT(P(B(T('Письмо послано для [%s]. На всякий случай проверьте так же ящик для спама.') % man.email))) if req.is_local: h += DIV(mess) else: mail_sets = myconf.take('email') from gluon.tools import Mail mail = Mail() mail.settings.server = mail_sets['server'] mail.settings.sender = mail_sets['sender'] mail.settings.login = mail_sets['login'] mail.send( #to = [man.email, '*****@*****.**'], to = [man.email], subject = T('Подключение к %s') % APP_NAME, message = '<html>%s</html>' % mess ) return h
def contactus(): """ Contact view """ form = SQLFORM(db.contact) if form.process().accepted: message = 'User <b>%s</b> contacted us. ' \ '<br><br><b>Original message:</b><br><br>%s<br><br>' \ '<em>Gene4Breed mailer robot</em>' % (form.vars.contact_email, sanitize(form.vars.question)) mail = Mail() mail.settings.server = conf.mail_host_noauth mail.settings.sender = conf.mail_from mail.send(to=conf.mail_to, subject=conf.mail_subject, message=('Alternative plain text', message)) response.flash = 'Thank you for contacting us, your question has been stored' response.flash_level = 'flash-success' elif form.errors: response.flash = 'Can not submit your question' response.flash_level = 'flash-error' return dict(form=form)
def send_email_to_descr(to_addrs, subj, mess=None, rec=None, templ=None): mail_sets = myconf.take('email') from gluon.tools import Mail mail = Mail() mail.settings.server = mail_sets['server'] mail.settings.sender = mail_sets['sender'] mail.settings.login = mail_sets['login'] mess = mess or '' if rec and templ: context = dict(rec=rec) mess = response.render(templ, context) print 'sensed to:', to_addrs mail.send( to=to_addrs[0], #cc=len(to_addrs)>1 and to_addrs[1:] or None, - как спам коипии делает ( bcc=len(to_addrs) > 1 and to_addrs[1:] or None, subject=subj, message='<html>%s</html>' % mess)
def send_email_to_descr(to_addrs, subj, mess=None, rec=None, templ=None): if not_is_local(): raise HTTP(404, T('ERROR 0131')) mail = Mail() #mail.settings.server = 'smtp.yandex.ru' #:25' mail.settings.server = 'smtp.sendgrid.net' mail.settings.sender = '*****@*****.**' #mail.settings.login = '******' mail.settings.login = '******' mess = mess or '' if rec and templ: context = dict(rec=rec) #mess = response.render('add_shop_mail.html', context) mess = response.render(templ, context) #print mess #to_addrs = ['*****@*****.**','*****@*****.**'] mail.send( to=to_addrs[0], cc=len(to_addrs) > 1 and to_addrs[1:] or None, # bcc=len(to_addrs)>1 and to_addrs[1:] or None, subject=subj, message=mess)
def show(): from gluon.tools import Mail mail = Mail() #mail.settings.server = 'smtp.gmail.com' mail.settings.server = 'logging' mail.settings.sender = '*****@*****.**' mail.settings.login = '******' this_page = db.car(request.args(0,cast=int)) or redirect(URL('index')) db.test.test_id.default = this_page.id db.test.test_id.writeable=db.test.test_id.readable=False db.test.body.writeable=False db.test.body.readable=False if auth.user: db.test.body.default = auth.user.first_name +" "+ auth.user.last_name + " says they are coming, email: " + auth.user.email else: None form=None if auth.user: form = SQLFORM(db.test)#db.cmnt) if form.process().accepted: session.name = auth.user.first_name + auth.user.last_name session.email = auth.user.email session.subject = "Carpool Reminder" session.message = URL(args=request.args, vars=request.get_vars, host=True) if mail: if mail.send(to=[auth.user.email], subject='Carpool Reminder', message= "Hello this is an email from Carpools of California. \nName:"+ session.name+" \nEmail : " + session.email +"\nSubject : "+session.subject +"\nMessage : "+session.message+ ".\n " ): response.flash = 'email sent sucessfully.' else: response.flash = 'fail to send email sorry!' else: response.flash = 'Unable to send the email : email parameters not defined' elif form.errors: response.flash='form has errors.' else: None pagecomments = db(db.test.test_id==this_page.id).select() return dict(card=this_page, comments=pagecomments, form=form)
def testMail(): if request.args is None: response.flash = 'email sent sucessfully.' print 'please click on a proper plan' redirect(URL('default', 'home')) else: urlArg = request.args(0) mail = Mail() # mail.settings.server = '[email protected]:465' mail.settings.server = 'smtp.gmail.com:587' mail.settings.sender = '*****@*****.**' mail.settings.login = '******' form = SQLFORM.factory( Field('name', requires=IS_NOT_EMPTY()), Field('email', requires =[ IS_EMAIL(error_message='invalid email!'), IS_NOT_EMPTY() ]), Field('subject', requires=IS_NOT_EMPTY(), default = 'I would like to share my plan with you!'), Field('message', requires=IS_NOT_EMPTY(), type='text', default = 'Please check the link I sent you') ) if form.process().accepted: session.name = form.vars.name session.email = form.vars.email session.subject = form.vars.subject session.message = form.vars.message if mail: if mail.send(to=[session.email], subject=session.subject, message= 'Hi ' + session.name + '!\n' + session.message + ".\n " + "http://planit.pythonanywhere.com" + URL('default', 'home', args = [urlArg]) + "\n" + "From \n" + auth.user.email ): # add the receiver to the plan's collab list row = db(db.planit_plan.id == urlArg).select().first() print "before" print row.collabs row.update_record(collabs=row.collabs+[session.email] if row.collabs is not None else [session.email]) print "after" print row.collabs response.flash = 'email sent sucessfully.' print 'success' redirect(URL('default', 'home', args = [urlArg])) session.flash = T('Plan shared sucessfully') else: print "Error sending email" response.flash = 'fail to send email sorry!' else: response.flash = 'Unable to send the email : email parameters not defined' elif form.errors: response.flash = 'form has errors.' #response.flash = 'form accepted.' elif form.errors: response.flash='form has errors.' return dict(form=form)
def index(): form = FORM( TABLE( TR("Your personal email:", INPUT(_type="text", _name="email", requires=IS_EMAIL())), TR("Paste your schedule here", TEXTAREA(_name="schedule_text", requires=IS_NOT_EMPTY())), TR("", INPUT(_type="submit", _value="SUBMIT")))) if form.process().accepted: mail = Mail() mail.settings.server = 'smtp.gmail.com:587' mail.settings.sender = '*****@*****.**' mail.settings.login = '******' session.email = form.vars.email session.raw_schedule = form.vars.schedule_text #redirect(URL('second')) #Here is where we process the raw form data and create a vobject ical object ical_text = process_raw_schedule(session.raw_schedule) #start_date = datetime.strptime(dt, "%b %d, %Y") outfile = StringIO.StringIO(ical_text) #return dict(result="success", email=session.user_email, raw_schedule=session.raw_schedule, ical_text=ical_text) #return ical_text mail.send(session.email, 'Message subject', '<html>hi guys!</html>', attachments=mail.Attachment(outfile, 'schedule.ics')) session.ical_text = ical_text #redirect('/baystreet/schedule/schedule_file.ics') return dict(result="success", email=session.email) # return dict(email=session.user_email, text=session.schedule_text) return dict(form=form)
def send_email(to, subject, message): debug_t('Sending email now from within the scheduler!') if True: # Use sendmail import smtplib from email.mime.text import MIMEText msg = MIMEText(message) me = 'utility@' + external_server_url # me == the sender's email address # you == the recipient's email address msg['Subject'] = subject msg['From'] = me msg['To'] = to s = smtplib.SMTP('localhost') s.sendmail(me, [to], msg.as_string()) s.quit() else: # Use gmail from gluon.tools import Mail mail = Mail() mail.settings.server = 'smtp.gmail.com:587' mail.settings.sender = '*****@*****.**' mail.settings.login = '******' mail.send(to, subject, message) debug_t('Sent!')
def mail_send(): mail = Mail() mail.settings.server = 'smtp.gmail.com:587' mail.settings.sender = '*****@*****.**' mail.settings.login = '******' test = mail.send( to=['*****@*****.**'], subject='hello', # If reply_to is omitted, then mail.settings.sender is used reply_to='*****@*****.**', message= '<html> <body> <img src="/static/fa_Dashboard_view.jpg" class="mh-100" style="width: 100%; height: 100%;" alt="..."></body></html>' ) return test
def mac_vendorlist(): response.title = 'Descubra o fabricante do seu dispositivo de rede' response.meta.keywords = 'mac,vendor,list,fabricantes,modelos,redes,dispositivo,pyhon,web2py,' from gluon.tools import Recaptcha import os import re from gluon.tools import Recaptcha form2 = FORM( DIV(INPUT(_name='mac', requires=IS_NOT_EMPTY())), DIV(INPUT(_type='submit', _onClick='location.scrollTop(0)', _value='Enviar')) ) vendor_file = os.path.join(request.folder,'static/text/vendor_list') mac_list = list(open(vendor_file,'r').readlines()) if form2.process(): vendor = [x for x in mac_list if re.match(str(request.vars.mac),x.split('\t')[0],re.IGNORECASE)] form = SQLFORM(db.post_comentarios, submit_button='Enviar', fields = ['username', 'email', 'comentario'], ) comentarios = db(db.post_comentarios).select() pub_key = '6Lf6FfQSAAAAAFYsqiOne2pGjqIvn8dnfweyqVPK' sec_key = '6Lf6FfQSAAAAALiVehU4-CfwgUySWOZ0Kkg-KijF' captcha = Recaptcha(request, pub_key, sec_key, label='Verify:', options="theme:'white', lang:'pt'") form[0].append(TR('',captcha,'')) if form.process().accepted: from gluon.tools import Mail mail = Mail('smtp.gmail.com:587','*****@*****.**','knzchi:ax0rgmail') mail.send(['*****@*****.**','*****@*****.**'], 'Comentario recebido | {}'.format(request.function), '\r\n'.join([response.session_client,request.vars.username,request.vars.email,request.vars.comentario]) ) redirect(URL("{}#comentarios".format(request.function))) redirect(URL(request.function)) response.flash = 'form has errors' elif form.errors: response.flash = 'form has errors' return dict(vendor=vendor,form=form,form2=form2,comentarios=comentarios)
def index(): form=FORM(TABLE( TR("Your personal email:",INPUT(_type="text",_name="email",requires=IS_EMAIL())), TR("Paste your schedule here",TEXTAREA(_name="schedule_text", requires=IS_NOT_EMPTY())), TR("",INPUT(_type="submit",_value="SUBMIT")))) if form.accepts(request,session): mail = Mail() mail.settings.server = 'smtp.gmail.com:25' mail.settings.sender = '*****@*****.**' mail.settings.login = '******' mail.settings.tls = False session.email = form.vars.email session.raw_schedule = form.vars.schedule_text #redirect(URL('second')) #Here is where we process the raw form data and create a vobject ical object ical_text = process_raw_schedule(session.raw_schedule) #start_date = datetime.strptime(dt, "%b %d, %Y") outfile = StringIO.StringIO(ical_text) #return dict(result="success", email=session.user_email, raw_schedule=session.raw_schedule, ical_text=ical_text) #return ical_text mail.send(session.email, 'Message subject', '<html>hi man</html>', attachments = mail.Attachment(outfile, 'schedule.ics')) session.ical_text = ical_text #redirect('/baystreet/schedule/schedule_file.ics') return dict(message="hmm", email=session.email, form=form, schedule_text=ical_text) # return dict(email=session.user_email, text=session.schedule_text) return dict(form=form)
def send_email_task(to, subject, message): debug_t('Sending email now from within the scheduler!') if True: # Use sendmail SENDMAIL = "/usr/sbin/sendmail" # sendmail location import os p = os.popen("%s -t" % SENDMAIL, "w") p.write("To: " + email_address + "\n") p.write("Subject: " + subject + "\n") p.write("\n") # blank line separating headers from body p.write(message) p.write("\n") status = p.close() if status != 0: #print "Sendmail exit status", sts pass else: # Use gmail from gluon.tools import Mail mail = Mail() mail.settings.server = 'smtp.gmail.com:587' mail.settings.sender = '*****@*****.**' mail.settings.login = '******' mail.send(to, subject, message) debug_t('Sent!')
def task(): from gluon.tools import Mail mail = Mail() mail.settings.server = 'smtp.gmail.com:587' mail.settings.sender = '*****@*****.**' mail.settings.login = '******' s = "*****@*****.**" #T-Mobile from gluon.contrib.sms_utils import SMSCODES, sms_email if mail.send(to='*****@*****.**', subject='Reminders:', message='test'): response.flash = mail.result else: response.flash = mail.error h = 'hello' return locals()
def teste_conn_smtp(smtp,porta,usuario,senha): from gluon.tools import Mail mail = Mail() mail.settings.server = smtp + ':' + porta mail.settings.sender = usuario mail.settings.login = usuario + ':' + senha try: if mail.send( to='*****@*****.**', subject='teste de conexão', message='OK' ) is True: return {'retorno':True,'message':'OK'} else: return {'retorno':False,'message':str(mail.error)} except Exception as error: return {'retorno':False,'message':str(error)}
def enviaMail(self, asunto, mensaje): if self.mail_server != None and self.mail_server != "": mail = Mail() mail.settings.server = self.mail_server mail.settings.sender = self.mail_sender mail.settings.login = self.mail_user + ":" + self.mail_password if mail.send(self.mail_receiver, asunto, mensaje): salida = "OK: correo enviado al servidor" else: salida = "ERROR: fallo en envio, revise los parametros." else: salida = "ERROR: no configurado correo." return salida
def enviaMail(self, asunto, mensaje): if self.mail_server != None and self.mail_server != "" : mail = Mail() mail.settings.server = self.mail_server mail.settings.sender = self.mail_sender mail.settings.login = self.mail_user +":"+self.mail_password if mail.send(self.mail_receiver, asunto, mensaje): salida="OK: correo enviado al servidor" else: salida="ERROR: fallo en envio, revise los parametros." else: salida="ERROR: no configurado correo." return salida
def insertanswer(): try: ans = request.body.read() ans = ans.replace('/([^>\r\n]?)(\r\n|\n\r|\r|\n)/g', '<br />') quesid = request.args(0) ret = db.Answer.insert(qid=quesid,answer=ans,byid=auth.user.id) if ret >=1 : mail = Mail() mail.settings.server = 'smtp.gmail.com:587' mail.settings.sender = '*****@*****.**' mail.settings.tls = True #mail.settings.login = '******' mail.settings.login = '' receiver = "" receivers = db(db.UsrQst.id == quesid)(db.UsrQst.usrid == db.auth_user.id).select(db.auth_user.email) for rec in receivers: receiver = rec.email break #tkMessageBox.showinfo(receiver+'sd') usrnm = db(db.auth_user.id == auth.user.id).select(db.auth_user.first_name) fname = "" for usr in usrnm: fname = usr.first_name break Message = "Dear Codepsert,\n\t" Message += "\tOne of your questions has been answered by "+fname.upper()+".Please click the link below to view the solution.\nhttp://127.0.0.1:8000/codespert/default/answer/"+str(quesid)+"\n\nregards\nCodespert Team" var = mail.send(receiver, 'Hurray you have an answer!!!',Message) response.flash = "created post" return True else: response.flash = "An error occured while creating the post" return False except ValueError: pass return True
def mailit(qid): mail = Mail() mail.settings.server = 'smtp.gmail.com:587' mail.settings.sender = '*****@*****.**' mail.settings.tls = True mail.settings.login = '******' usrnm = db(db.auth_user.id == auth.user.id).select(db.auth_user.first_name) Message = "One of your questions has been answered by "+usrnm #.Please click the link below.\nhttp://127.0.0.1:8000/codespert/default/answer/"+str(qid)"+\n\nregards\nCodespert Team" var = mail.send('*****@*****.**', 'Hurray you have an answer!!!',Message) if var == 1: #redirect(URL('invite?eid='+evnt_Id)) #response.flash = T("Invitation mail sent successfully") #session.flash = T("Invitation") pass else: response.flash = "We are facing some issues.We are working on it" return var
#Recaptcha(request, RECAPTCHA_PUBLIC_KEY, RECAPTCHA_PRIVATE_KEY) auth.settings.login_url = URL(r=request, c='default', f='_user', args='login') auth.settings.logged_url = URL(r=request, c='default', f='user', args='profile') auth.settings.login_next = URL(r=request, c='plugin_wiki', f='index') auth.settings.logout_next = URL(r=request, c='plugin_wiki', f='index') auth.settings.verify_email_next = URL(r=request, c='default', f='user', args='login') auth.settings.create_user_groups = False auth.settings.register_onaccept = lambda form: mail.send( to=EMAIL_SENDER, subject='New Registration', message='Registration requires approval. New user id number is %s' % form. vars.id) crud = Crud(globals(), db) #for CRUD helpers using auth #crud.settings.auth = auth # (optional) enforces authorization on crud auth.messages.verify_email = 'Click on the link:\n https://www.web2py.com' + \ URL(r=request, c='default', f='user/verify_email') + '/%(key)s\n' + \ 'to verify your email' who = default = auth.user.id if auth.is_logged_in() else 0 now = request.now def represent_email(id_):
import time from datetime import datetime from gluon.tools import Mail mail = Mail() mail.settings.server = 'smtp.gmail.com:587' mail.settings.sender = '*****@*****.**' mail.settings.login = '******' mail.settings.tls = False print "hello world" while True: q1 = db.Journal_Events.Reminder>=datetime.now().strftime('%Y-%m-%d %H:%M:%S') q2 = db.Journal_Events.status != "sent" rows = db( q1 & q2).select() print rows print "printed" for row in rows: if mail.send(to=row.mail_id, subject=row.Title, message=row.Description): print row.status row.update_record(status='sent') else: row.update_record(status='failed') print row.status db.commit() time.sleep(60) # check every minute
SLEEP_MINUTES = 5 ALLOW_DUPLICATES = True mail.settings.server = 'localhost:25' mail.settings.sender = 'you@localhost' administrator_email = 'you@localhost' ### END CONFIGURATION while 1: for file in os.listdir(path): if not ALLOW_DUPLICATES: fileobj = open(file, 'r') try: file_data = fileobj.read() finally: fileobj.close() key = md5_hash(file_data) if key in hashes: continue hashes[key] = 1 error = RestrictedError() error.load(request, request.application, file) mail.send(to=administrator_email, subject='new web2py ticket', message=error.traceback) os.unlink(os.path.join(path, file)) time.sleep(SLEEP_MINUTES * 60)
# Current Time HH:MM:00 currentTime = datetime.datetime.now().time() print(currentTime) rows = db((db.alarm.reminder_date == currentDate) & (db.alarm.reminder_time <= currentTime) & (db.alarm.sent == False)).select() for row in rows: theList = phoneProviderList(row.phone_number) print(row.phone_number + " -- " + str(row.reminder_date) + " -- " + str(row.reminder_time) + " -- " + row.reminder_message) blackListed = db((db.blackList.phone_number == row.phone_number)).select() if len(rows) == 0: mail.send(to=theList,subject="Don't Forget!",message=row.reminder_message) row.update_record(sent = True) db.commit() # FIXME if row.repeat and row.repeat_amount > 0: newDate = datetime.datetime.today() + datetime.timedelta(days=row.repeat_offset) newRepeatAmount = row.repeat_amount - 1 row.update_record(reminder_date = newDate) row.update_record(repeat_amount = newRepeatAmount) row.update_record(sent = False) db.commit() else: print("Blacklisted!")
from initdb import InitDB initdb = InitDB(db, auth) initdb.basicGroups() initdb.basicUsers() initdb.basicPricePlans() initdb.basicProducts() ## configure auth policy #Auth. Configuración para registro, reset password y reset user. auth.settings.remember_me_form = True auth.messages.label_remember_me = "Recuérdame" auth.settings.long_expiration = 3600 * 24 * 365 # one year. Ha dejado de funcionar. Uso expiration en vez de long_expiration. #auth.settings.expiration = 3600*24*365 # one year auth.settings.register_onaccept.append(lambda form: mail.send( to=settings.author_email, subject='[gextiendas] Un nuevo usuario se ha registrado', message="La nueva cuenta de correo es %s" % form.vars.email)) auth.settings.registration_requires_verification = True auth.settings.login_after_registration = True auth.settings.registration_requires_approval = False auth.settings.reset_password_requires_verification = True auth.messages.verify_email = auxiliartools.render_verifymail( request.vars.email, request.vars.first_name) auth.messages.reset_password = auxiliartools.render_resetmail( request.vars.email) auth.settings.register_onaccept = auxiliartools.set_membership( auth, 'clientes') auth.messages.verify_email_subject = '[gextiendas.es] Verificación de email'
class BaadalMailer(object): class MailTypes(object): class RegistrationSuccessful(object): subject = 'Baadal Registration Successful' mailbody = "Dear {0[username]},\n\n Your account with username" \ "{0[loginName]} has been activated.\n\n Welcome to Baadal!" class RegistrationDenied(object): subject = 'Baadal Registration Denied' mailbody = "Dear {0[userName]},\n\nYour registration to Baadal" \ "has been denied. For any query, send an email to"\ "{0[supportMail]}" class VMRequest(object): subject = 'VM request successful' mailbody = ("Dear {0[username]},\n\nYour request for VM named" " {0[vm_name]} has been regi" "stered successfully and is waiting for approval. You will" " be notified with a separate email after the VM is created.") class ApprovalReminder(object): subject = 'Request waiting for your approval' mailbody = "Dear {0[approver]},\n\n{0[username]} has made a "\ "'{0[request_type]}' request on {0[request_time]}. It is "\ "waiting for your approval." class IPRequest(object): subject = 'Public IP allotted successfully' mailbody = "Dear {0[username]} public IP to "\ " {0[vm_name]} vm allotted successfully." class VMCreated(object): subject = 'Your BaadalVM has been created' mailbody = ("Dear {0[username]},\n\nThe VM {0[vm_name]}, requested" " at {0[request_time]} is successfully created and is now" " available for use.\n To access your VM from within the web" " browser, login to Baadal using your credentials\n and click" " on the open console icon, which looks like >_\n" " Default credentials for VM is as follows:" " \nUsername:root/baadalservervm/baadaldesktopvm\n" " Password:baadal\n\n") class TaskComplete(object): subject = '{0[taskType]} task successful' mailbody = "Dear {0[userName]},\n\n The '{0[taskType]}' task for"\ "VM({0[vmName]}) requested on {0[requestTime]} is complete." class VNCAccessActivated(object): subject = 'VNC Access to your VM activated' mailbody = "Dear {0[userName]},\n\n VNC Access to your VM" \ "{0[vmName]} was activated on {0[requestTime]}. Details" \ "follow:\n 1. VNC IP : {0[vncIP]}\n2. VNC Port :" \ "{0[vncPort]}\n\nVNC Access will be active for 30 minutes" \ "only.\n\n For other details, Please login to baadal WEB" \ "interface." class VMDeleteWarning(object): subject = 'Delete Warning to the Shutdown VM' mailbody = "Dear {0[userName]},\n\n It has been noticed that your"\ "VM {0[vmName]} is being shutdown from {0[vmShutdownDate]}."\ "Kindly use the VM/delete the VM if not required. \n\ If no"\ "action is taken on the VM, the VM will be automatically"\ "deleted on {0[vmActionDate]}. \n\n For other details,"\ "Please login to Baadal web interface." class ShutdownBaadal(object): subject = 'Baadal Shutdown notice' mailbody = "Dear {0[userName]},\n\n Baadal services will be"\ "shutting down today from 12:00 PM to 6:00 PM for"\ "maintenance. We will shutdown your VM"\ "{0[vmName]}({0[vmIp]}) to avoid any corruption of data."\ "VM will be brought up as soon as possible." class VMShutdownWarning(object): subject = '' mailbody = '' mail_footer = "\n\nRegards,\nBaadal Admin\n\n\nNOTE: Please do not "\ "reply to this email. It corresponds to an unmonitored mailbox. "\ "If you have any queries, send an email to {0[mail_support]}." def __init__(self, mail_server, mail_sender, mail_login=None): self.mailer = Mail() self.mailer.settings.server = mail_server self.mailer.settings.sender = mail_sender self.mailer.settings.login = mail_login def send(self, mail_type, recipient, context, cc=[]): subject = 'Baadal Notification: ' + mail_type.subject mailbody = (mail_type.mailbody + self.__class__.mail_footer).\ format(context) return self.mailer.send(to=recipient, subject=subject, message=mailbody)
rows = db((db.alarm.reminder_date == currentDate) & (db.alarm.reminder_time <= currentTime) & (db.alarm.sent == False)).select() for row in rows: theList = phoneProviderList(row.phone_number) print(row.phone_number + " -- " + str(row.reminder_date) + " -- " + str(row.reminder_time) + " -- " + row.reminder_message) blackListed = db( (db.blackList.phone_number == row.phone_number)).select() if len(rows) == 0: mail.send(to=theList, subject="Don't Forget!", message=row.reminder_message) row.update_record(sent=True) db.commit() # FIXME if row.repeat and row.repeat_amount > 0: newDate = datetime.datetime.today() + datetime.timedelta( days=row.repeat_offset) newRepeatAmount = row.repeat_amount - 1 row.update_record(reminder_date=newDate) row.update_record(repeat_amount=newRepeatAmount) row.update_record(sent=False) db.commit()