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


Python utils.send_mail函数代码示例

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


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

示例1: process_form_submission

    def process_form_submission(self, form):
        super(AbstractEmailForm, self).process_form_submission(form)

        if self.to_address:
            addresses = [x.strip() for x in self.to_address.split(',')]
            content = '\n'.join([x[1].label + ': ' + text_type(form.data.get(x[0])) for x in form.fields.items()])
            send_mail(self.subject, content, addresses, self.from_address,)
开发者ID:InnovaCo,项目名称:wagtail,代码行数:7,代码来源:models.py

示例2: test_send_default_from_email

    def test_send_default_from_email(self):
        send_mail("Test subject", "Test content", ["[email protected]"])

        # Check that the email was sent
        self.assertEqual(len(mail.outbox), 1)
        self.assertEqual(mail.outbox[0].subject, "Test subject")
        self.assertEqual(mail.outbox[0].body, "Test content")
        self.assertEqual(mail.outbox[0].to, ["[email protected]"])
        self.assertEqual(mail.outbox[0].from_email, "[email protected]")
开发者ID:timorieber,项目名称:wagtail,代码行数:9,代码来源:tests.py

示例3: test_send_fallback_to_default_from_email_setting

    def test_send_fallback_to_default_from_email_setting(self):
        send_mail("Test subject", "Test content", ["[email protected]"])

        # Check that the email was sent
        self.assertEqual(len(mail.outbox), 1)
        self.assertEqual(mail.outbox[0].subject, "Test subject")
        self.assertEqual(mail.outbox[0].body, "Test content")
        self.assertEqual(mail.outbox[0].to, ["[email protected]"])
        self.assertEqual(mail.outbox[0].from_email, "[email protected]")
开发者ID:timorieber,项目名称:wagtail,代码行数:9,代码来源:tests.py

示例4: test_send_email

    def test_send_email(self):
        send_mail("Test subject", "Test content", ["[email protected]"], "[email protected]")

        # Check that the email was sent
        self.assertEqual(len(mail.outbox), 1)
        self.assertEqual(mail.outbox[0].subject, "Test subject")
        self.assertEqual(mail.outbox[0].body, "Test content")
        self.assertEqual(mail.outbox[0].to, ["[email protected]"])
        self.assertEqual(mail.outbox[0].from_email, "[email protected]")
开发者ID:timorieber,项目名称:wagtail,代码行数:9,代码来源:tests.py

示例5: process_form_submission

    def process_form_submission(self, form):
        super(AbstractEmailForm, self).process_form_submission(form)

        if self.to_address:
            content = ''
            for x in form.fields.items():
                if not isinstance(x[1], SweetCaptchaField):  # exclude SweetCaptchaField from notification
                    content += '\n' + x[1].label + ': ' + text_type(form.data.get(x[0]))
            send_mail(self.subject, content, [self.to_address], self.from_address,)
开发者ID:jordij,项目名称:wagtailsweetcaptcha,代码行数:9,代码来源:models.py

示例6: send_mail

 def send_mail(self, form):
     addresses = [x.strip() for x in self.to_address.split(',')]
     content = []
     for field in form:
         value = field.value()
         if isinstance(value, list):
             value = ', '.join(value)
         content.append('{}: {}'.format(field.label, value))
     content = '\n'.join(content)
     send_mail(self.subject, content, addresses, self.from_address,)
开发者ID:thenewguy,项目名称:wagtail,代码行数:10,代码来源:models.py

示例7: process_form_submission

    def process_form_submission(self, form):
        self.get_submission_class().objects.create(
            form_data=json.dumps(form.cleaned_data, cls=DjangoJSONEncoder),
            page=self, user=form.user
        )

        if self.to_address:
            addresses = [x.strip() for x in self.to_address.split(',')]
            content = '\n'.join([x[1].label + ': ' + text_type(form.data.get(x[0])) for x in form.fields.items()])
            send_mail(self.subject, content, addresses, self.from_address,)
开发者ID:timorieber,项目名称:wagtail,代码行数:10,代码来源:models.py

示例8: process_form_submission

    def process_form_submission(self, form):
        super(AbstractEmailForm, self).process_form_submission(form)

        if self.to_address:
            content = '\n'.join([x[1].label + ': ' + text_type(form.data.get(x[0])) for x in form.fields.items()])
            if 'your-name' in form.data and 'your-email' in form.data:
                subject = u'{}: {} <{}>'.format(self.subject, form.data['your-name'], form.data['your-email'])
            else:
                subject = self.subject
            send_mail(subject, content, [self.to_address], self.from_address,)
开发者ID:littleweaver,项目名称:littleweaverweb.com,代码行数:10,代码来源:models.py

示例9: serve

    def serve(self, request, *args, **kwargs):
        if request.is_ajax() and request.method == "POST":
            form = GoogleAdGrantApplicationForm(request.POST)
            if form.is_valid():
                form.save()

                if self.to_address:
                    subject = "{} form submission".format(self.title)
                    content = '\n'.join([x[1].label + ': ' + str(form.data.get(x[0])) for x in form.fields.items()])
                    send_mail(subject, content, [self.to_address],)
                return render(
                    request,
                    'torchbox/includes/ad_grant_application_landing.html',
                    {'self': self, 'form': form}
                )
            else:
                return render(
                    request,
                    'torchbox/includes/ad_grant_application_form.html',
                    {'self': self, 'form': form}
                )
        else:
            return super(GoogleAdGrantsPage, self).serve(request)
开发者ID:spapas,项目名称:wagtail-torchbox,代码行数:23,代码来源:models.py

示例10: process_form_submission

    def process_form_submission(self, form):
        super(AbstractEmailForm, self).process_form_submission(form)

        if self.to_address:
            content = '\n'.join([x[1].label + ': ' + form.data.get(x[0]) for x in form.fields.items()])
            send_mail(self.subject, content, [self.to_address], self.from_address,)
开发者ID:EricSchles,项目名称:wagtail,代码行数:6,代码来源:models.py

示例11: send_mail

 def send_mail(self, form):
     addresses = [x.strip() for x in self.to_address.split(',')]
     content = '\n'.join([x[1].label + ': ' + text_type(form.data.get(x[0])) for x in form.fields.items()])
     send_mail(self.subject, content, addresses, self.from_address,)
开发者ID:jaydensmith,项目名称:wagtail,代码行数:4,代码来源:models.py


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