Example #1
0
 def test_fail_silently(self):
     send_mail(
         u'件名',
         u'本文',
         u'差出人 <[email protected]>',
         [u'宛先 <[email protected]>'],
         fail_silently=True,
     )
     send_template_mail(
         u'mailer/mail.tpl',
         u'差出人 <[email protected]>',
         [u'宛先 <[email protected]>'],
         extra_context={
             'subject': u'件名',
             'body': u'本文',
         },
         fail_silently=True,
     )
     send_mass_mail(((
         u'件名',
         u'本文',
         u'差出人 <[email protected]>',
         [u'宛先 <example%[email protected]>' % i],
     ) for i in range(10)), fail_silently=True)
     mail_managers(
         u'件名',
         u'本文',
         fail_silently=True,
     )
     mail_managers_template(
         u'mailer/mail.tpl',
         extra_context={
             'subject': u'件名',
             'body': u'本文',
         },
         fail_silently=True,
     )
     mail_admins(
         u'件名',
         u'本文',
         fail_silently=True,
     )
Example #2
0
 def test_fail_loud(self):
     try:
         send_mail(
             u'件名',
             u'本文',
             u'差出人 <[email protected]>',
             [u'宛先 <[email protected]>'],
         )
         self.fail("Expected Error")
     except EmailError:
         pass
     try:
         send_template_mail(
             u'mailer/mail.tpl',
             u'差出人 <[email protected]>',
             [u'宛先 <[email protected]>'],
             extra_context={
                 'subject': u'件名',
                 'body': u'本文',
             },
         )
         self.fail("Expected Error")
     except EmailError:
         pass
     try:
         send_mass_mail(((
             u'件名',
             u'本文',
             u'差出人 <[email protected]>',
             [u'宛先 <example%[email protected]>' % i],
         ) for i in range(10)))
         self.fail("Expected Error")
     except EmailError:
         pass
     try:
         mail_managers(
             u'件名',
             u'本文',
         )
         self.fail("Expected Error")
     except EmailError:
         pass
     try:
         mail_managers_template(
             u'mailer/mail.tpl',
             extra_context={
                 'subject': u'件名',
                 'body': u'本文',
             },
         )
         self.fail("Expected Error")
     except EmailError:
         pass
     try:
         mail_admins(
             u'件名',
             u'本文',
         )
         self.fail("Expected Error")
     except EmailError:
         pass