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


Python GenericMailer.send方法代码示例

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


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

示例1: _sendErrorEmail

# 需要导入模块: from MaKaC.webinterface.mail import GenericMailer [as 别名]
# 或者: from MaKaC.webinterface.mail.GenericMailer import send [as 别名]
    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,代码行数:34,代码来源:dvdCreation.py

示例2: _sendMail

# 需要导入模块: from MaKaC.webinterface.mail import GenericMailer [as 别名]
# 或者: from MaKaC.webinterface.mail.GenericMailer import send [as 别名]
    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,代码行数:28,代码来源:category.py

示例3: notify

# 需要导入模块: from MaKaC.webinterface.mail import GenericMailer [as 别名]
# 或者: from MaKaC.webinterface.mail.GenericMailer import send [as 别名]
 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,代码行数:9,代码来源:registrantNotificator.py

示例4: _sendReport

# 需要导入模块: from MaKaC.webinterface.mail import GenericMailer [as 别名]
# 或者: from MaKaC.webinterface.mail.GenericMailer import send [as 别名]
    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,代码行数:32,代码来源:error.py

示例5: run

# 需要导入模块: from MaKaC.webinterface.mail import GenericMailer [as 别名]
# 或者: from MaKaC.webinterface.mail.GenericMailer import send [as 别名]
    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,代码行数:31,代码来源:__init__.py

示例6: _sendReport

# 需要导入模块: from MaKaC.webinterface.mail import GenericMailer [as 别名]
# 或者: from MaKaC.webinterface.mail.GenericMailer import send [as 别名]
    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,代码行数:33,代码来源:error.py

示例7: run

# 需要导入模块: from MaKaC.webinterface.mail import GenericMailer [as 别名]
# 或者: from MaKaC.webinterface.mail.GenericMailer import send [as 别名]
    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,代码行数:35,代码来源:tasks.py

示例8: notify

# 需要导入模块: from MaKaC.webinterface.mail import GenericMailer [as 别名]
# 或者: from MaKaC.webinterface.mail.GenericMailer import send [as 别名]
 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,代码行数:9,代码来源:registrantNotificator.py

示例9: _sendReport

# 需要导入模块: from MaKaC.webinterface.mail import GenericMailer [as 别名]
# 或者: from MaKaC.webinterface.mail.GenericMailer import send [as 别名]
 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,代码行数:11,代码来源:errors.py

示例10: run

# 需要导入模块: from MaKaC.webinterface.mail import GenericMailer [as 别名]
# 或者: from MaKaC.webinterface.mail.GenericMailer import send [as 别名]
 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,代码行数:13,代码来源:timerExec.py

示例11: notifyAll

# 需要导入模块: from MaKaC.webinterface.mail import GenericMailer [as 别名]
# 或者: from MaKaC.webinterface.mail.GenericMailer import send [as 别名]
 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,代码行数:13,代码来源:registrantNotificator.py

示例12: _sendEmail

# 需要导入模块: from MaKaC.webinterface.mail import GenericMailer [as 别名]
# 或者: from MaKaC.webinterface.mail.GenericMailer import send [as 别名]
    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,代码行数:16,代码来源:dvdCreation.py

示例13: _process

# 需要导入模块: from MaKaC.webinterface.mail import GenericMailer [as 别名]
# 或者: from MaKaC.webinterface.mail.GenericMailer import send [as 别名]
 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,代码行数:17,代码来源:trackModif.py

示例14: addPendingParticipant

# 需要导入模块: from MaKaC.webinterface.mail import GenericMailer [as 别名]
# 或者: from MaKaC.webinterface.mail.GenericMailer import send [as 别名]
    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,代码行数:48,代码来源:participant.py

示例15: _sendSecondaryEmailNotifiication

# 需要导入模块: from MaKaC.webinterface.mail import GenericMailer [as 别名]
# 或者: from MaKaC.webinterface.mail.GenericMailer import send [as 别名]
    def _sendSecondaryEmailNotifiication(self, email):
        data = {}
        data["toList"] = [email]
        data["fromAddr"] = Config.getInstance().getSupportEmail()
        data["subject"] = """[Indico] Email address confirmation"""
        data["body"] = """Dear %s,

You have added a new email to your secondary email list.

In order to confirm and activate this new email address, please open in your web browser the following URL:

%s

Once you have done it, the email address will appear in your profile.

Best regards,
Indico Team""" % (self._user.getStraightFullName(), url_for('user.userRegistration-validateSecondaryEmail',
                                                            userId=self._user.getId(),
                                                            key=md5(email).hexdigest(),
                                                            _external=True))
        GenericMailer.send(GenericNotification(data))
开发者ID:pferreir,项目名称:indico-backup,代码行数:23,代码来源:user.py


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