当前位置: 首页>>代码示例>>Python>>正文


Python mail.GenericMailer类代码示例

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


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


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