• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Python web.sendmail函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Python中web.sendmail函数的典型用法代码示例。如果您正苦于以下问题:Python sendmail函数的具体用法?Python sendmail怎么用?Python sendmail使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了sendmail函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。

示例1: __helper

    def __helper(self, form):
        salt = hashlib.sha1(urandom(16)).hexdigest()
        print "here"
        #SQL query to INSERT a record into the table FACTRESTTBL.
        cur.execute('''INSERT INTO Users (first_name, last_name, encrypted_password, email, created_at, updated_at, current_sign_in_at, last_sign_in_at, current_sign_in_ip, last_sign_in_ip, privilege)
                        VALUES (%s, %s, %s, %s, NOW(), NOW(), NOW(), NOW(), %s, %s, %s)''',
                        (form.d.first_name, 
                        form.d.last_name, 
                        salt + hashlib.sha1(salt + form.d.password).hexdigest(),
                        form.d.email,
                        web.ctx['ip'],
                        web.ctx['ip'],
                        form.d.privilege))

        # Commit your changes in the database
        db.commit()
        try:
            web.config.smtp_server = 'smtp.gmail.com'
            web.config.smtp_port = 587
            web.config.smtp_username = '[email protected]'
            web.config.smtp_password = 'hmsFinalProject'
            web.config.smtp_starttls = True
            web.sendmail('[email protected]', form.d.email, 'Welcome to HMS!', 'Hello, '+form.d.first_name+'! Congratulations you are now apart of the HMS family!')
        except:
            print "Error: unable to send email"
开发者ID:georgiev2592,项目名称:hms,代码行数:25,代码来源:server.py


示例2: POST

 def POST(self):
     data = web.input()
     try:
         web.sendmail(websafe(data.email), m.User.by_id(1).email, "Blog About Page Contact from: %s" % websafe(data.name), websafe(data.message))
         flash("error","Thanks for Contacting me!")
     except Exception,e:
         flash("error","Sorry, there was a problem, message not sent")
开发者ID:andreztz,项目名称:webpy-bootstrap-blog,代码行数:7,代码来源:app.py


示例3: send_bao

def send_bao(
    name, total, order_info, timestamp, payment="cash", email_from=localconf.email, email_to=localconf.to_email
):
    message = """%s, you got a new bao order! 

order:

    for: %s
    order: %s

    payment: %s
    total: %s

    placed: %s

you rock!
""" % (
        localconf.name,
        name,
        order_info,
        payment,
        total,
        timestamp,
    )
    subject = "a new bao order! %s wants %s, total: $%s (%s)" % (name, order_info, total, payment)
    web.sendmail(email_from, email_to, subject, message)
开发者ID:stephenbalaban,项目名称:baozi,代码行数:26,代码来源:main.py


示例4: POST

    def POST(self):
        context = web.ctx.request
        i = web.input()
        email = i.email.strip()
        password = i.password
        if not email:
            web.ctx.msg = u"邮箱地址不能为空"
            raise web.seeother('/auth/reg')
        user = User(email=email, password=hash_password(password))
        web.ctx.orm.add(user)
        #web.ctx.orm.commit()

        u = web.ctx.orm.query(User).filter(User.email==email).first()
        if u:
            active_key = gen_sha1(u.email)
            context['active_key'] = active_key
            context['uid'] = u.id
            user_signup = UserSignup(user=u, active_key=active_key)
            web.ctx.orm.add(user_signup)
            web.ctx.orm.commit()
            #web.ctx.session.login = 1
            web.ctx.session.email = email
            web.sendmail(web.config.smtp_username, email, u'注册邮件',
                         render_mail('templates/auth/activation_email_message.txt', **context))

            raise web.seeother('/auth/succ')
        else:
            raise
开发者ID:qq40660,项目名称:qingblog,代码行数:28,代码来源:auth.py


示例5: _batch_job_done_callback

    def _batch_job_done_callback(self, batch_job_id, result, send_mail=None):
        """ Called when the batch job with id jobid has finished.
            result is a dictionnary, containing:

            - {"retval": 0, "stdout": "...", "stderr": "...", "file": "..."}
                if everything went well.(where file is a tgz file containing the content of the / output folder from the container)
            - {"retval": "...", "stdout": "...", "stderr": "..."}
                if the container crashed (retval is an int != 0)
            - {"retval": -1, "stderr": "the error message"}
                if the container failed to start
        """

        # If there is a tgz file to save, put it in gridfs
        if "file" in result:
            result["file"] = self._gridfs.put(result["file"].read())

        # Save submission to database
        self._database.batch_jobs.update(
            {"_id": batch_job_id},
            {"$set": {"result": result}}
        )

        # Send a mail to user
        if send_mail is not None:
            try:
                web.sendmail(web.config.smtp_sendername, send_mail, "Batch job {} finished".format(batch_job_id),
                             """This is an automated message.

The batch job you launched on INGInious is done. You can see the results on the "batch operation" page of your course
administration.""")
            except Exception as e:
                print "Cannot send mail: " + str(e)
开发者ID:harcharansidhu,项目名称:INGInious,代码行数:32,代码来源:batch_manager.py


示例6: POST

 def POST(self):
     data=web.input()
     email=data.get('email', '').lower()
     newpassword = data.get('newpw','')
     oldpassword = data.get('oldpw','')
     print 'Password change attempt...'
     if email:
         if  not emailregex.match(email):
             return "Invalid email."
         print 'non logged in user'
         newpassword=usermodel.resetPassword(email)
         if newpassword:
             body = '<p>Your account recently asked for a password reset.  <p>'
             body+= 'Here is the new password:  %s</p>' % (newpassword)
             body+= '<p>Please click here and login: <a href="http://www.actuallyheard.com/">Log In</a></p></html>'
             web.sendmail('Actually Heard',email,'Password Reset', body, headers=({'Content-Type':'text/html; charset="utf-8";'}))
             return True
         else:
             return "No email registered."
     elif session.userid!='none' and newpassword!='':
         oldpw = hashlib.sha256(oldpassword).hexdigest()
         if usermodel.authUser(session.email, oldpw):
             stat=usermodel.changePassword(session.userid,newpassword)
             if stat:
                 body = '<p>Your account recently changed the password to login.  <p>'
                 body+= '<p>If this was unauthorized, please click <a href="http://www.actuallyheard.com/contactus">here</a> and notify us.</p></html>'
                 web.sendmail('Actually Heard',session.email,'Password Change', body, headers=({'Content-Type':'text/html; charset="utf-8";'}))
                 return True
     return 'Invalid Email';
开发者ID:scoot557,项目名称:ah,代码行数:29,代码来源:code.py


示例7: sendmail_to_signatory

def sendmail_to_signatory(user, pid):
    p = db.select('petition', where='id=$pid', vars=locals())[0]
    p.url = 'http//watchdog.net/c/%s' % (pid) 
    token = auth.get_secret_token(user.email)
    msg = render_plain.signatory_mailer(user, p, token)
    #@@@ shouldn't this web.utf8 stuff taken care by in web.py?
    web.sendmail(web.utf8(config.from_address), web.utf8(user.email), web.utf8(msg.subject.strip()), web.utf8(msg))
开发者ID:christopherbdnk,项目名称:watchdog,代码行数:7,代码来源:petition.py


示例8: send_followup

def send_followup(msgid, response_body):
    from_addr = config.from_address
    to_addr = get_sender_email(msgid)
    if not to_addr: return
    subject = 'FILL IN HERE'
    body = response_body +  'FILL IN HERE'                   
    web.sendmail(from_addr, to_addr, subject, body)
开发者ID:AuroraSkywalker,项目名称:watchdog,代码行数:7,代码来源:load_responses.py


示例9: POST

        def POST(self):
            auxiliar = POSTParse(web.data())
            Form = ForgottenForm

            S = sessionmaker(bind=DB)()
            LocDB = create_engine(UserDB, echo=False)
            Me = S.query(Student).filter(Student.ra == auxiliar['ra'])

            if Me.count():
                caracters = '0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ'
                newpass = ''
                for char in xrange(8):
                        newpass += choice(caracters)

                ThisUser = S.query(User).filter(User.student_id == Me.one().id).one()

                web.sendmail('[email protected]', str(ThisUser.email), 'Recuperar Senha - GDA', 'Sua nova senha é: '+
                newpass+'\n \n Caso ache necessário, você pode mudar sua senha na página de alteração de dados cadatrais do GDA.')

                stmt = update(User).where(ThisUser.email == User.email).values(password=encode(newpass))
                LocDB.execute(stmt)
                raise web.seeother('/login')

            else:
                return Render.forgottenpassword(Form, "Não existe usuário cadastrado com o RA fornecido!", Render)
开发者ID:LSchanner,项目名称:gda,代码行数:25,代码来源:app.py


示例10: POST

 def POST(self, slug):
     entry, p = self.getEntry(slug)
     f = commentForm()
     if f.validates():
         comment = Comment(entry.id, f.username.value, f.email.value, f.url.value, f.comment.value)
         entry.comment_num = entry.comment_num + 1
         entry.view_num = entry.view_num - 1
         web.ctx.orm.add(comment)
         emails = ['[email protected]']
         message = u'<p>您在&lt;泥泞的沼泽&gt;上回复的日志 "' + entry.title + u'" 又有新的回复了, 请您去看看.</p><p>' \
             u'<a href="http://davidx.me/entry/' + slug + u'/#comments">点击查看回复</a></p>'
         for c in entry.comments:
             emails.append(c.email)
         for e in set(emails):
             try:
                 web.sendmail('[email protected]', e,
                     '您在"泥泞的沼泽"上回复的日志又有新的回复了!'.encode('utf-8'), message,
                     headers={'Content-Type':'text/html;charset=utf-8'})
             except:
                 pass
         raise web.seeother('/entry/%s/' % slug)
     else:
         d['p'] = p
         d['entry'] = entry
         d['f'] = f
         d['usedTime'] = time.time() - d['startTime']
         return render.entry(**d)
开发者ID:Giiithub,项目名称:davidblog,代码行数:27,代码来源:views.py


示例11: POST

	def POST(self):
		form = web.input()
		if form.email != None:
			if len(form.email) > 0:
				# generate api key info
				key = uuid.uuid4()
				key_hash = hashlib.md5(str(key)).digest().encode('utf-8')
				# add info to database
				email = form.email
				name = form.name
				org_name = form['organization name']
				org_url = form['organization url']
				use = form['intended use']
				reschk = db.select('users',where='email=$email OR apikey=$key_hash',vars={'email':email, 'key_hash':key_hash})
				if len(reschk.list()) > 0:
					return self.ERR('This email address is already registered, check your records for your API Key')
				else:
					res = db.insert('users',name=name,email=email,organization_name=org_name,organization_url=org_url,intended_use=use,apikey=key_hash,is_active=0)
					# send email with api key			
					text = """Thank you for registering for a ALEC Exposed API key.

Please visit the following URL to verify your email address and activate your key
%s/register/activate/%s

Your details are included below for your records:
    Email: %s
    API Key: %s
""" %(root_url,key,email,key)
					web.sendmail('[email protected]',email,"ALEC Exposed Registration",text)
					return docs().thanks('Thank you for registering, click the link in your email to activate your API Key')
			else:
				return self.ERR('A valid email address is required')
		else:
			return self.ERR('A valid email address is required')
开发者ID:HengeSense,项目名称:ALEC_api,代码行数:34,代码来源:api.py


示例12: POST

    def POST(self, path):
        if not self.is_scan_user():
            return permission_denied('Permission denied.')

        book = web.ctx.site.get(path)
        i = web.input("scan_status", _comment=None)
        
        q = {
            'key': '/scan_record' + path,
            'scan_status': {
                'connect': 'update',
                'value': i.scan_status
            }
        }
        web.ctx.site.write(q, i._comment)

        def get_email(user):
            try:
                delegate.admin_login()
                return web.utf8(web.ctx.site.get_user_email(user.key).email)
            finally:
                web.ctx.headers = []

        scan_record = get_scan_record(path)
        to = scan_record.sponsor and get_email(scan_record.sponsor)
        cc = getattr(config, 'scan_email_recipients', [])
        if to:
            if i.scan_status == 'SCAN_IN_PROGRESS':
                message = render.scan_inprogress_email(book, scan_record, i._comment)
            else:    
                message = render.scan_book_notfound_email(book, scan_record, i._comment)
            web.sendmail(config.from_address, to, message.subject.strip(), str(message), cc=cc)
        raise web.seeother(web.changequery(query={}))
开发者ID:amoghravish,项目名称:openlibrary,代码行数:33,代码来源:code.py


示例13: POST

    def POST(self):
        if not support_db:
            return "Couldn't initialise connection to support database"
        form = web.input()
        email = form.get("email", "")
        topic = form.get("topic", "")
        description = form.get("question", "")
        url = form.get("url", "")
        user = accounts.get_current_user()
        useragent = web.ctx.env.get("HTTP_USER_AGENT","")
        if not all([email, topic, description]):
            return ""
        c = support_db.create_case(creator_name      = user and user.get_name() or "",
                                   creator_email     = email,
                                   creator_useragent = useragent,
                                   creator_username  = user and user.get_username() or "",
                                   subject           = topic,
                                   description       = description,
                                   url               = url,
                                   assignee          = config.get("support_case_default_address","[email protected]"))

        # Send an email to the creator of the case
        subject = "Case #%s: %s"%(c.caseno, topic)
        message = render_template("email/support_case", c)
        web.sendmail(config.get("support_case_control_address","[email protected]"), 
                     email, subject, message)

        return render_template("email/case_created", c)
开发者ID:iambibhas,项目名称:openlibrary,代码行数:28,代码来源:support.py


示例14: thread_send_mail

def thread_send_mail(email,passwd):
    web.config.smtp_server = 'smtp.gmail.com'
    web.config.smtp_port = 587
    web.config.smtp_username = '[email protected]'
    web.config.smtp_password = 'qq53376122'
    web.config.smtp_starttls = True
    web.sendmail('[email protected]', email, 'nomadic修改密码', passwd)
开发者ID:tianshu-secret,项目名称:nomadic,代码行数:7,代码来源:code.py


示例15: GET

 def GET(self):
     web.config.smtp_server = 'smtp.gmail.com'
     web.config.smtp_port = 587
     web.config.smtp_username = '[email protected]'
     web.config.smtp_password = 'passwor'
     web.config.smtp_starttls = True
     web.sendmail('[email protected]','[email protected]','message','message content')
开发者ID:xiangyuan,项目名称:Iwu,代码行数:7,代码来源:iwuo.py


示例16: __disabled_POST

    def __disabled_POST(self):
        i = web.input(_method='post')
        i['type.key'] = '/type/comment'
        i['_comment'] = ''
        path = '/c/'+ str(get_random_string())

        # prevent most common spam
        if 'url' in  i['comment'] and 'link' in i['comment'] and 'http://' in i['comment']:
            return web.seeother(i['article.key'])
        if '<a href' in  i['comment'] and 'http://' in i['comment']:
            return web.seeother(i['article.key'])
        if i['website'] in ['http://www.yahoo.com/', 'http://www.google.com/', 'http://www.bing.com/', "http://www.facebook.com/"]:
            return web.seeother(i['article.key'])            
          
        query = {
            'key': path,
            'type': {'key': "/type/comment"},
            'article': {"key": i["article.key"]},
            'comment': {'type': '/type/text', 'value': i['comment']},
            'author': i['author'],
            'website': i['website'],
            'email': i['email'],
            'permission':  {'key': '/permission/restricted'} 
        }

        web.ctx.site.save(query, comment='new comment')

        c = web.ctx.site.get(path)
        msg = render.comment_email(c, web.ctx.home)
        try:
            web.sendmail(config.from_address, config.comment_recipients, web.utf8(msg.subject).strip(), web.utf8(msg))
        except:
            import traceback
            traceback.print_exc()
        web.seeother(i['article.key']+"#comments")
开发者ID:anandology,项目名称:kottapalli,代码行数:35,代码来源:code.py


示例17: POST

 def POST(self):
   web.sendmail(
     web.config.smtp_username, 
     str(Form['E-mail'].value),
     '99Party - Esqueci minha senha',
     'Mensagem'
   )
开发者ID:gabisurita,项目名称:99party,代码行数:7,代码来源:main.py


示例18: GET

    def GET(self, id=None):
        #if id is None, email every active user with his balance
        if id is not None:
            users = [get_object_or_404(User, id=id)]
        else:
            users = User.filter(active=True)

        default_tpl = settings.MAIL_DEFAULT_TEMPLATE
        try:
            f = open(settings.MAIL_FILE_TEMPLATE, 'rb')
            tpl = pickle.load(f)
            f.close()
        except (IOError, pickle.PickleError):
            tpl = default_tpl

        userside = web.input(u=0).u != 0 # used to check if the mail is coming from a QR scan
        for u in users:
            utpl = default_tpl
            if u.balance < 0 and not userside:
                utpl = tpl
            
            body = utpl.format(apayer = float2str(-u.balance if u.balance <0 else 0), 
                               solde = float2str(u.balance), 
                               prenom = u.firstname, 
                               nom = u.lastname)

            web.sendmail(settings.MAIL_ADDRESS, u.email, 'Your INGI cafetaria balance', body)

        if userside:
            return render_no_layout.consume('BALANCE', u)

        raise web.seeother('/')
开发者ID:ancailliau,项目名称:INGIfet,代码行数:32,代码来源:ingifet.py


示例19: sendMessage

    def sendMessage(self, subject, content):
        mailSendFrom = 'monitor-py'
        mailSendTo = '[email protected]' #['[email protected]', '[email protected]']

        web.sendmail(mailSendFrom, mailSendTo, subject, content)
        # send sms ...
        return "ok"
开发者ID:yaoms,项目名称:myHomeConfs,代码行数:7,代码来源:MsgSender.py


示例20: fetch_and_update

def fetch_and_update(imap_conn, db_conn = None):
    for resp in get_new_emails(imap_conn):
        try:
            messageid, message = parse_imap_response(resp)
        except Exception,e:
            logger.warning(" Message parsing failed", exc_info = True)
            continue
        m = subject_re.search(message['Subject'])
        if m:
            caseid = m.groups()[0]
            logger.debug(" Updating case %s", caseid)
            try:
                frm = email.utils.parseaddr(message['From'])[1]
                case = db_conn.get_case(caseid)
                casenote = get_casenote(message)
                update_support_db(frm, casenote, case)
                imap_move_to_folder(imap_conn, messageid, "Accepted")
                message = template%dict(caseno = caseid,
                                        message = casenote,
                                        author = frm)
                subject = "Case #%s updated"%(caseid)
                assignee = case.assignee
                web.sendmail("[email protected]", assignee, subject, message)
            except Exception, e:
                logger.warning(" Couldn't update case. Resetting message", exc_info = True)
                imap_reset_to_unseen(imap_conn, messageid)
开发者ID:mangtronix,项目名称:openlibrary,代码行数:26,代码来源:fetchmail.py



注:本文中的web.sendmail函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python web.setcookie函数代码示例发布时间:2022-05-26
下一篇:
Python web.select函数代码示例发布时间:2022-05-26
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap