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

Python mail.GenericMailer类代码示例

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

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



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

示例1: _sendErrorEmail

    def _sendErrorEmail(self, e):
        ty, ex, tb = sys.exc_info()
        tracebackList = traceback.format_list(traceback.extract_tb(tb))
        text = (
            _(
                """
                    Offline website creation for the [event:%s] had caused
                    an error while running the task.

                    - Request from user: %s <%s>

                    - Details of the exception:
                        %s

                    - Traceback:

                        %s

                    --

                    <Indico support> indico-project @ cern.ch
                    """
            )
            % (self._conf.getId(), self._toUser.getFullName(), self._toUser.getEmail(), e, "\n".join(tracebackList))
        )
        maildata = {
            "fromAddr": Config.getInstance().getSupportEmail(),
            "toList": [Config.getInstance().getSupportEmail()],
            "subject": _("[Indico] Error in task: Offline website creation"),
            "body": text,
        }
        GenericMailer.send(GenericNotification(maildata))
开发者ID:bubbas,项目名称:indico,代码行数:32,代码来源:dvdCreation.py


示例2: _sendMail

    def _sendMail(self, currentList, newManager):
        if isinstance(newManager, AvatarUserWrapper):
            managerName = newManager.getStraightFullName()
        else:
            managerName = newManager.getName()
        text = (
            _(
                """Dear managers,

%s has been added as manager for the category '%s':

%s

Best regards,
Indico Team
        """
            )
            % (managerName, self._categ.getName(), UHCategModifAC.getURL(self._categ))
        )
        maildata = {
            "fromAddr": "%s" % Config.getInstance().getNoReplyEmail(),
            "toList": [manager.getEmail() for manager in currentList],
            "subject": "New category manager",
            "body": text,
        }
        GenericMailer.send(GenericNotification(maildata))
开发者ID:MichelCordeiro,项目名称:indico,代码行数:26,代码来源:category.py


示例3: run

    def run(self, check=True):
        import smtplib
        from MaKaC.webinterface.mail import GenericMailer, GenericNotification

        # prepare the mail
        send = self._prepare(check=check)

        # _prepare decided we shouldn't send the mail?
        if not send:
            return

        # just in case some ill-behaved code generates empty addresses
        addrs = list(smtplib.quoteaddr(x) for x in self.toAddr if x)
        ccaddrs = list(smtplib.quoteaddr(x) for x in self.ccAddr if x)

        if len(addrs) + len(ccaddrs) == 0:
            self.getLogger().warning("Attention: no recipients, mail won't be sent")
        else:
            self.getLogger().info("Sending mail To: %s, CC: %s" % (addrs, ccaddrs))

        for user in self.toUser:
            addrs.append(smtplib.quoteaddr(user.getEmail()))

        if addrs or ccaddrs:
            GenericMailer.send(GenericNotification({"fromAddr": self.fromAddr,
                                                    "toList": addrs,
                                                    "ccList": ccaddrs,
                                                    "subject": self.subject,
                                                    "body": self.text }))
开发者ID:pferreir,项目名称:indico-backup,代码行数:29,代码来源:__init__.py


示例4: run

    def run(self, check=True):
        import smtplib
        from MaKaC.webinterface.mail import GenericMailer, GenericNotification

        # prepare the mail
        send = self._prepare(check=check)

        # _prepare decided we shouldn't send the mail?
        if not send:
            return

        addrs = [smtplib.quoteaddr(x) for x in self.toAddr]
        ccaddrs = [smtplib.quoteaddr(x) for x in self.ccAddr]

        if len(addrs) + len(ccaddrs) == 0:
            self.getLogger().warning("Attention: mail contains no recipients!")
        else:
            self.getLogger().info("Sending mail To: %s, CC: %s" % (addrs, ccaddrs))

        for user in self.toUser:
            addrs.append(smtplib.quoteaddr(user.getEmail()))

        GenericMailer.send(
            GenericNotification(
                {
                    "fromAddr": self.fromAddr,
                    "toList": addrs,
                    "ccList": ccaddrs,
                    "subject": self.subject,
                    "body": self.text,
                }
            )
        )
开发者ID:bubbas,项目名称:indico,代码行数:33,代码来源:tasks.py


示例5: notify

 def notify(self,registrant,params):
     if params.has_key("conf"):
         GenericMailer.sendAndLog(self.apply(registrant,params),
                                  params["conf"],
                                  log.ModuleNames.REGISTRATION)
     else:
         GenericMailer.send(self.apply(registrant,params))
开发者ID:NIIF,项目名称:indico,代码行数:7,代码来源:registrantNotificator.py


示例6: askForExcuse

    def askForExcuse(self, eventManager, toIdList):
        data = self.prepareAskForExcuse(eventManager,toIdList)
        if data is None :
            return False

        GenericMailer.sendAndLog(GenericNotification(data),self._conference,"participants",eventManager)
        return True
开发者ID:bubbas,项目名称:indico,代码行数:7,代码来源:participant.py


示例7: _sendReport

    def _sendReport( self ):
        cfg = Config.getInstance()

        # if no e-mail address was specified,
        # add a default one
        if self._userMail:
            fromAddr = self._userMail
        else:
            fromAddr = '[email protected]'

        toAddr = Config.getInstance().getSupportEmail()
        Logger.get('errorReport').debug('mailing %s' % toAddr)
        subject = "[[email protected]%s] Error report"%cfg.getBaseURL()

        request_info = self._requestInfo or ''
        if isinstance(request_info, (dict, list)):
            request_info = pformat(request_info)

        # build the message body
        body = [
            "-" * 20,
            "Error details\n",
            self._code,
            self._message,
            "Inner error: " + str(self._inner),
            request_info,
            "-" * 20
        ]
        maildata = {"fromAddr": fromAddr, "toList": [toAddr], "subject": subject, "body": "\n".join(body)}
        GenericMailer.send(GenericNotification(maildata))
开发者ID:k3njiy,项目名称:indico,代码行数:30,代码来源:error.py


示例8: notify

 def notify(self,registrant,params):
     if params.has_key("conf"):
         GenericMailer.sendAndLog(self.apply(registrant,params),
                                  params["conf"],
                                  'Registration')
     else:
         GenericMailer.send(self.apply(registrant,params))
开发者ID:svdoever,项目名称:indico,代码行数:7,代码来源:registrantNotificator.py


示例9: setStatusDeclined

    def setStatusDeclined(self, responsibleUser=None, sendMail=True):
        if self._status != "pending" :
            return False
        self._status = "declined"
        
        logData = self.getParticipantData()
        logData["subject"] = _("%s : status set to DECLINED")%self.getWholeName()
        self.getConference().getLogHandler().logAction(logData,"participants",responsibleUser)

        if sendMail:
            data = {}
            data["fromAddr"] = info.HelperMaKaCInfo.getMaKaCInfoInstance().getSupportEmail()
            confTitle = self._participation.getConference().getTitle()
            data["subject"] = _("Your application for attendance in %s declined")%confTitle
            toList = []
            toList.append(self._email)
            title = ""
            if self._title == "" or self._title is None :
                title = self._firstName
            else:
                title = self._title        
            data["toList"] = toList
            data["body"] = _("""
            Dear %s %s,
            
            your request to attend the %s has been declined by the event manager.
            
            Your Indico
            """)%(title, self._familyName, confTitle)
                        
            GenericMailer.sendAndLog(GenericNotification(data),self.getConference(),"participants",responsibleUser)
        
        return True
开发者ID:davidmorrison,项目名称:indico,代码行数:33,代码来源:participant.py


示例10: _sendReport

    def _sendReport(self):
        info = HelperMaKaCInfo().getMaKaCInfoInstance()
        cfg = Config.getInstance()

        # if no e-mail address was specified,
        # add a default one
        if self._userMail:
            fromAddr = self._userMail
        else:
            fromAddr = "[email protected]"

        toAddr = info.getSupportEmail()

        Logger.get("errorReport").debug("mailing %s" % toAddr)

        subject = "[[email protected]%s] Error report" % cfg.getBaseURL()

        # build the message body
        body = [
            "-" * 20,
            "Error details\n",
            self._code,
            self._message,
            "Inner error: " + str(self._inner),
            str(self._requestInfo),
            "-" * 20,
        ]
        maildata = {"fromAddr": fromAddr, "toList": [toAddr], "subject": subject, "body": "\n".join(body)}

        # send it
        GenericMailer.send(GenericNotification(maildata))
开发者ID:lukasnellen,项目名称:indico,代码行数:31,代码来源:error.py


示例11: askForExcuse

    def askForExcuse(self, eventManager, toIdList):
        data = self.prepareAskForExcuse(eventManager, toIdList)
        if data is None :
            return False

        GenericMailer.sendAndLog(GenericNotification(data), self._conference,
                                 log.ModuleNames.PARTICIPANTS)
        return True
开发者ID:Json-Andriopoulos,项目名称:indico,代码行数:8,代码来源:participant.py


示例12: _sendReport

 def _sendReport(self):
     cfg = Config.getInstance()
     fromAddr = self._userMail
     toAddr = cfg.getSupportEmail()
     subject = "[[email protected]%s] Error report" % cfg.getBaseURL()
     body = ["-"*20, "User Comments\n", "%s\n\n" % self._comments, "-"*20,
             "Error details\n", self._msg, "-" * 20]
     maildata = {"fromAddr": fromAddr, "toList": [toAddr], "subject": subject, "body": "\n".join(body)}
     GenericMailer.send(GenericNotification(maildata), skipQueue=True)
开发者ID:Ictp,项目名称:indico,代码行数:9,代码来源:errors.py


示例13: _process_retry_setup

 def _process_retry_setup(self):
     # clear the fossile cache at the start of each request
     fossilize.clearCache()
     # clear after-commit queue
     flush_after_commit_queue(False)
     # delete all queued emails
     GenericMailer.flushQueue(False)
     # clear the existing redis pipeline
     if self._redisPipeline:
         self._redisPipeline.reset()
开发者ID:NIIF,项目名称:indico,代码行数:10,代码来源:base.py


示例14: run

 def run(self):
     addrs = []
     ccaddrs = []
     for addr in self.toAddr:
         addrs.append(smtplib.quoteaddr(addr))
     for ccaddr in self.ccAddr:
         ccaddrs.append(smtplib.quoteaddr(ccaddr))
     for user in self.toUser:
         addrs.append(smtplib.quoteaddr(user.getEmail()))
     maildata = { "fromAddr": self.fromAddr, "toList": addrs, "ccList": ccaddrs, "subject": self.subject, "body": self.text }
     GenericMailer.send(GenericNotification(maildata))
开发者ID:bubbas,项目名称:indico,代码行数:11,代码来源:timerExec.py


示例15: notifyAll

 def notifyAll(self,params):
     subj=params.get("subject","")
     b=params.get("body","")
     fa=params.get("from","")
     tl=params.get("to",[])
     cc = params.get("cc",[])
     notification =  Notification(subject=subj,body=b,fromAddr=fa,toList=tl,ccList=cc)
     if params.has_key("conf"):
         GenericMailer.sendAndLog(notification, params["conf"])
     else:
         GenericMailer.send(notification)
开发者ID:bubbas,项目名称:indico,代码行数:11,代码来源:registrantNotificator.py


示例16: _sendEmail

    def _sendEmail(self, ofu):
        text = _("""
                    Offline website creation for your event
                    was finished and you can recover the zip file from
                    the following URL:
                    <%s>

                    Thanks for using Indico

                    --
                    Indico
                    """)%ofu
        maildata = { "fromAddr": info.HelperMaKaCInfo.getMaKaCInfoInstance().getSupportEmail(), "toList": [self._toUser.getEmail()], "subject": _("[Indico] Offline website creation done"), "body": text }
        GenericMailer.send(GenericNotification(maildata))
开发者ID:davidmorrison,项目名称:indico,代码行数:14,代码来源:dvdCreation.py


示例17: _process_success

 def _process_success(self):
     Logger.get('requestHandler').info('Request {} successful'.format(request))
     # request is succesfull, now, doing tasks that must be done only once
     try:
         flush_after_commit_queue(True)
         GenericMailer.flushQueue(True)  # send emails
         self._deleteTempFiles()
     except:
         Logger.get('mail').exception('Mail sending operation failed')
     # execute redis pipeline if we have one
     if self._redisPipeline:
         try:
             self._redisPipeline.execute()
         except RedisError:
             Logger.get('redis').exception('Could not execute pipeline')
开发者ID:NIIF,项目名称:indico,代码行数:15,代码来源:base.py


示例18: _process

 def _process( self ):
     count = 0
     for abstract in self._abstracts:
         dict = AbstractNotification(self._conf, abstract).getDict()
         s = self._notifTpl.getTplSubject()
         b = self._notifTpl.getTplBody()
         maildata = { "fromAddr": self._notifTpl.getFromAddr(), "toList": [abstract.getSubmitter().getEmail()], "subject": s%dict, "body": text }
         GenericMailer.send(GenericNotification(maildata))
         self._conf.newSentMail(abstract.getSubmitter(), mail.getSubject(), b%dict)
         count += 1
         
     #self._redirect(urlHandlers.UHConfAbstractManagment.getURL(self._conf))
     
     p = conferences.WPAbstractSendNotificationMail(self, self._conf, count )
     return p.display()
开发者ID:lukasnellen,项目名称:indico,代码行数:15,代码来源:trackModif.py


示例19: addParticipant

    def addParticipant(self, participant, eventManager = None):
        # check if it's worth to add the participant
        if participant.getConference().getId() != self._conference.getId() :
            return False
        self.removePendingParticipant(participant)
        if not participant.setId(self._newParticipantId()):
            return False
        if self.alreadyParticipating(participant) != 0 :
            return False
        self._participantList["%d"%self._lastParticipantId()] = participant

        # remove him from the "pending" list
        if participant in self._pendingParticipantList.values() :
            for k in self._pendingParticipantList.keys() :
                if self._pendingParticipantList[k] == participant :
                    del self._pendingParticipantList[k]
                    break

        logData = participant.getParticipantData()
        logData["subject"] = _("New participant added : %s")%participant.getWholeName()
        self._conference.getLogHandler().logAction(logData,
                                                   log.ModuleNames.PARTICIPANTS)

        participant.setStatusAdded()

        # check if an e-mail should be sent...
        if self._addedInfo :
            # to notify the user of his/her addition
            if eventManager is None :
                return False
            data = self.prepareAddedInfo(participant, eventManager)
            GenericMailer.sendAndLog(GenericNotification(data),
                                     self._conference,
                                     log.ModuleNames.PARTICIPANTS)

        avatar = participant.getAvatar()

        if avatar is None :
            # or to encourage him/her to register at Indico
            #self.sendEncouragementToCreateAccount(participant)
            pass
        else:
            # OK, if we have an avatar, let's keep things consistent
            avatar.linkTo(self._conference,"participant")

        self.notifyModification()
        return True
开发者ID:Json-Andriopoulos,项目名称:indico,代码行数:47,代码来源:participant.py


示例20: addPendingParticipant

    def addPendingParticipant(self, participant):
        if participant.getConference().getId() != self._conference.getId() :
            return False
        if participant.getId() is not None :
            return False
        if self.alreadyParticipating(participant) != 0 :
            return False
        if self.isAutoAccept():
            self.addParticipant(participant)
        else:
            self._pendingParticipantList["%d"%self._newPendingId()] = participant

            logData = participant.getParticipantData()
            logData["subject"] = _("New pending participant : %s")%participant.getWholeName()
            self._conference.getLogHandler().logAction(logData,
                                                       log.ModuleNames.PARTICIPANTS)

            participant.setStatusPending()

            profileURL = urlHandlers.UHConfModifParticipantsPending.getURL(self._conference)

            toList = []
            creator=self._conference.getCreator()
            if isinstance(creator, Avatar) :
                toList.append(creator.getEmail())
            for manager in self._conference.getAccessController().getModifierList() :
                if isinstance(manager, Avatar) :
                    toList.append(manager.getEmail())

            data = {}
            data["toList"] = toList
            data["fromAddr"] = Config.getInstance().getSupportEmail()
            data["subject"] = _("New pending participant for %s")%self._conference.getTitle()
            data["body"] = """
            Dear Event Manager,

            a new person is asking for participation in %s.
            Personal profile of this pending participant is available at %s
            Please take this candidature into consideration and accept or reject it

            Your Indico
            """%(self._conference.getTitle(), profileURL)

            GenericMailer.send(GenericNotification(data))
            self.notifyModification()
        return True
开发者ID:Json-Andriopoulos,项目名称:indico,代码行数:46,代码来源:participant.py



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
Python mail.GenericNotification类代码示例发布时间:2022-05-24
下一篇:
Python general.WebFactory类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

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

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

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