Пример #1
0
 def send(self, to, sender_profile, **context_args):
     content = self.render(**context_args)
     email_kwargs = dict(to=to,
                         sender_profile=sender_profile,
                         subject=content.subject,
                         message=content.body)
     if check_that_remote_connections_are_okay('MAILGUN POST:',
                                               email_kwargs):
         send_mailgun_email(**email_kwargs)
Пример #2
0
 def send(self, to, sender_profile, **context_args):
     content = self.render(**context_args)
     email_kwargs = dict(
         to=to,
         sender_profile=sender_profile,
         subject=content.subject,
         message=content.body
     )
     if check_that_remote_connections_are_okay(
             'MAILGUN POST:', email_kwargs):
         send_mailgun_email(**email_kwargs)
Пример #3
0
 def test_calls_async_and_passes_correct_args(self, mock_mailgun_auth,
                                              mock_tasks):
     with self.settings(ALLOW_REQUESTS_TO_MAILGUN=True):
         send_mailgun_email('*****@*****.**', 'hello foo', self.profile,
                            'Hello')
     mock_tasks.celery_request.assert_called_once_with(
         'POST',
         MAILGUN_MESSAGES_API_URL,
         auth=mock_mailgun_auth.return_value,
         data={
             "from": "Jane Doe <*****@*****.**>",
             "to": ['*****@*****.**'],
             "subject": 'Hello',
             "text": 'hello foo'
         })
Пример #4
0
def send_applicant_notification(contact_info, message, subject=None,
                                sender_profile=None):
    results = []
    if SMS in contact_info:
        results.append(
            front_sms.send(contact_info[SMS], message))
    if EMAIL in contact_info:
        results.append(
            send_mailgun_email(
                contact_info[EMAIL], message, subject=subject,
                sender_profile=sender_profile))
    return results
Пример #5
0
def send_applicant_notification(contact_info, message, subject=None,
                                sender_profile=None):
    results = []
    if SMS in contact_info:
        results.append(
            front_sms.send(contact_info[SMS], message))
    if EMAIL in contact_info:
        results.append(
            send_mailgun_email(
                contact_info[EMAIL], message, subject=subject,
                sender_profile=sender_profile))
    return results
Пример #6
0
 def test_doesnt_run_without_setting_true(self, mock_tasks):
     del settings.ALLOW_REQUESTS_TO_MAILGUN
     result = send_mailgun_email('*****@*****.**', 'hello foo', self.profile,
                                 'Hello')
     mock_tasks.assert_not_called()
     self.assertEqual({}, result)