예제 #1
0
 def _send(self):
     module = import_module(self._provider)
     message = clean_html(self._message)
     for phone in self._recipient_list:
         if self._from_email:
             module.send(
                 phone, message, sms_from=self._from_email, **self._kwargs)
         else:
             module.send(phone, message, **self._kwargs)
예제 #2
0
 def _send(self):
     self._provider = self._provider or self.provider
     module = import_module(self._provider)
     message = clean_html(self._message)
     for phone in self._recipient_list:
         if self._from_email:
             module.send(
                 phone, message, sms_from=self._from_email, **self._kwargs)
         else:
             module.send(phone, message, **self._kwargs)
예제 #3
0
 def _send(self):
     self._provider = self._provider or self.provider
     module = import_module(self._provider)
     message = clean_html(self._message)
     for phone in self._recipient_list:
         options = self._kwargs.copy()
         options['event'] = self._kwargs.pop('event', self._subject)
         if self._from_email:
             options['app'] = self._from_email
         module.send(phone, message, **options)
예제 #4
0
    def _send(self):
        message = clean_html(self._message)

        options = self._kwargs.copy()
        options.update(message=message,
                       event=self._kwargs.pop('event', self._subject))
        if self._from_email:
            options['app'] = self._from_email

        module = import_module(self._provider)

        for address in self._recipient_list:
            module.send(address, **options)
예제 #5
0
    def _send(self):
        message = clean_html(self._message)

        options = self._kwargs.copy()
        options.update(
            message=message,
            event=self._kwargs.pop('event', self._subject)
        )
        if self._from_email:
            options['app'] = self._from_email

        module = import_module(self._provider)

        for address in self._recipient_list:
            module.send(address, **options)
예제 #6
0
def db_sender(*args, **kwargs):
    from dbmail import import_module

    retry_delay = kwargs.pop('retry_delay', SEND_RETRY_DELAY)
    time_limit = kwargs.pop('time_limit', SEND_MAX_TIME)
    max_retries = kwargs.pop('max_retries', SEND_RETRY)
    backend = import_module(kwargs.get('backend'))
    retry = kwargs.pop('retry', True)

    try:
        if DEBUG is True:
            return backend.SenderDebug(*args, **kwargs).send(is_celery=True)
        return backend.Sender(*args, **kwargs).send(is_celery=True)
    except Exception as exc:
        if retry is True and max_retries:
            raise db_sender.retry(
                retry=retry, max_retries=max_retries,
                countdown=retry_delay, exc=exc,
                time_limit=time_limit,
            )
        raise
예제 #7
0
def db_sender(*args, **kwargs):
    from dbmail import import_module

    retry_delay = kwargs.pop('retry_delay', SEND_RETRY_DELAY)
    time_limit = kwargs.pop('time_limit', SEND_MAX_TIME)
    max_retries = kwargs.pop('max_retries', SEND_RETRY)
    backend = import_module(kwargs.get('backend'))
    retry = kwargs.pop('retry', True)

    try:
        if DEBUG is True:
            return backend.SenderDebug(*args, **kwargs).send(is_celery=True)
        return backend.Sender(*args, **kwargs).send(is_celery=True)
    except Exception as exc:
        if retry is True and max_retries:
            raise db_sender.retry(
                retry=retry,
                max_retries=max_retries,
                countdown=retry_delay,
                exc=exc,
                time_limit=time_limit,
            )
        raise
예제 #8
0
 def _send(self):
     module = import_module(self.provider)
     for recipient in self._recipient_list:
         module.send(recipient, self._message)
예제 #9
0
 def _send_by_custom_provider(self):
     module = import_module(self._provider)
     module.send(self)
예제 #10
0
 def _send_by_custom_provider(self):
     module = import_module(self._provider)
     module.send(self)
예제 #11
0
 def _send(self):
     module = import_module(self._provider)
     message = clean_html(self._message)
     for _id in self._recipient_list:
         module.send(_id, message, _from=self._from_email, **self._kwargs)
예제 #12
0
def clean_html(message):
    from dbmail.defaults import MESSAGE_HTML2TEXT

    module = import_module(MESSAGE_HTML2TEXT)
    return module.html2text(message)