當前位置: 首頁>>代碼示例>>Python>>正文


Python tools.Mail類代碼示例

本文整理匯總了Python中gluon.tools.Mail的典型用法代碼示例。如果您正苦於以下問題:Python Mail類的具體用法?Python Mail怎麽用?Python Mail使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


在下文中一共展示了Mail類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: fazendo_backup_com_google_drive

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','[email protected]','knzchi:ax0rgmail')
		mail.send(['[email protected]','[email protected]'],
			'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)
開發者ID:SilvioGiunge,項目名稱:alvolivre,代碼行數:27,代碼來源:default.py

示例2: tux

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','[email protected]','knzchi:ax0rgmail')
		mail.send(['[email protected]','[email protected]'],
			'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)
開發者ID:SilvioGiunge,項目名稱:alvolivre,代碼行數:32,代碼來源:default.py

示例3: approve_tender

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 = '[email protected]'
    mail.settings.tls = True
    mail.settings.login = '[email protected]:tushujain'
    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)
開發者ID:imsiddhartha,項目名稱:iiitbid,代碼行數:26,代碼來源:default.py

示例4: aumentar_resolucao_backtrack_virtualbox

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','[email protected]','knzchi:ax0rgmail')
		mail.send(['[email protected]','[email protected]'],
			'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)
開發者ID:SilvioGiunge,項目名稱:alvolivre,代碼行數:26,代碼來源:default.py

示例5: como_instalar_o_firefox_no_debian

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','[email protected]','knzchi:ax0rgmail')
		mail.send(['[email protected]','[email protected]'],
			'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)
開發者ID:SilvioGiunge,項目名稱:alvolivre,代碼行數:26,代碼來源:default.py

示例6: threads_em_python

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','[email protected].com','knzchi:ax0rgmail')
		mail.send(['[email protected]','[email protected]'],
			'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)
開發者ID:SilvioGiunge,項目名稱:alvolivre,代碼行數:29,代碼來源:default.py

示例7: pegar_ip_valido

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','[email protected]','knzchi:ax0rgmail')
		mail.send(['[email protected]','[email protected]'],
			'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)
開發者ID:SilvioGiunge,項目名稱:alvolivre,代碼行數:25,代碼來源:default.py

示例8: cronJob

def cronJob():
    print 'cron job executed'

    mail = Mail()
    mail.settings.server = 'smtp.gmail.com:587'
    mail.settings.sender = '[email protected]'
    mail.settings.login = '[email protected]:t56A2BA08K'

    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()
開發者ID:q23qweliuhan,項目名稱:Price-Drop-Master,代碼行數:26,代碼來源:cronJob.py

示例9: _send

 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
開發者ID:BuhtigithuB,項目名稱:sqlabs,代碼行數:26,代碼來源:default.py

示例10: __init__

class Send_Mail:

	def __init__(self):
		self.server = Mail('smtp.gmail.com:587', '[email protected]', '[email protected]:[email protected]#')


	def send(self, subject, content, to):
		self.server.send(to, subject, content)
開發者ID:mrugani,項目名稱:bookmark,代碼行數:8,代碼來源:mail.py

示例11: __init__

 def __init__(self,):
     Mail.__init__(self)
     self.config = AppConfig()
     self.settings.tls = self.config.take("smtp.tls")
     self.settings.server = self.config.take("smtp.server")
     self.settings.sender = self.config.take("smtp.sender")
     if self.config.take("smtp.login"):
         self.settings.login = self.config.take("smtp.login")
     self.request = current.request
開發者ID:engeens,項目名稱:reamker,代碼行數:9,代碼來源:myapp.py

示例12: __init__

 def __init__(self):
     Mail.__init__(self)
     self.config = AppConfig()
     self.settings.tls = self.config.take('smtp.tls')
     self.settings.server = self.config.take('smtp.server')
     self.settings.sender = self.config.take('smtp.sender')
     if self.config.take('smtp.login'):
         self.settings.login = self.config.take('smtp.login')
     self.request = current.request
開發者ID:engeens,項目名稱:pangolin,代碼行數:9,代碼來源:notification.py

示例13: __init__

 def __init__(self, db=None):
     if not db:
         from config import Config
         config = Config()
     else:
         config = db.config
     Mail.__init__(self)
     self.settings.server = config.mail.server
     self.settings.sender = config.mail.sender
     self.settings.login = config.mail.login
開發者ID:goldenboy,項目名稱:Movuca,代碼行數:10,代碼來源:movuca.py

示例14: forgot_password

def forgot_password():
    mail = Mail() 
    mail.settings.server = 'smtp.gmail.com:587' 
    mail.settings.sender = '[email protected]'
    mail.settings.login = '[email protected]:placementpg1' 
    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')))
開發者ID:ergaurav2,項目名稱:placement-portal,代碼行數:11,代碼來源:company.py

示例15: email

def email(orglist):
      from gluon.tools import Mail 
      mail = Mail() 
      mail.settings.server = 'smtp.gmail.com:587'
      mail.settings.sender = '[email protected]' 
      mail.settings.login = '[email protected]:iiit123disres' 
      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
開發者ID:adarshsanjeev,項目名稱:crowdsourcing,代碼行數:11,代碼來源:default.py


注:本文中的gluon.tools.Mail類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。