How to use the rss2email.SendmailError function in rss2email

To help you get started, we’ve selected a few rss2email examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github rss2email / rss2email / rss2email.py View on Github external
def sendmail_send(sender, recipient, message, config=None, section='DEFAULT'):
    if config is None:
        config = CONFIG
    LOG.debug(
        'sending message to {} via /usr/sbin/sendmail'.format(recipient))
    try:
        p = _subprocess.Popen(
            ['/usr/sbin/sendmail', recipient],
            stdin=_subprocess.PIPE, stdout=_subprocess.PIPE,
            stderr=_subprocess.PIPE)
        stdout,stderr = p.communicate(message.as_string().encode('ascii'))
        status = p.wait()
        if status:
            raise SendmailError(status=status, stdout=stdout, stderr=stderr)
    except Exception as e:
        raise SendmailError() from e
github rss2email / rss2email / rss2email.py View on Github external
def sendmail_send(sender, recipient, message, config=None, section='DEFAULT'):
    if config is None:
        config = CONFIG
    LOG.debug(
        'sending message to {} via /usr/sbin/sendmail'.format(recipient))
    try:
        p = _subprocess.Popen(
            ['/usr/sbin/sendmail', recipient],
            stdin=_subprocess.PIPE, stdout=_subprocess.PIPE,
            stderr=_subprocess.PIPE)
        stdout,stderr = p.communicate(message.as_string().encode('ascii'))
        status = p.wait()
        if status:
            raise SendmailError(status=status, stdout=stdout, stderr=stderr)
    except Exception as e:
        raise SendmailError() from e
github rss2email / rss2email / rss2email.py View on Github external
def __init__(self, status=None, stdout=None, stderr=None):
        if status:
            message = 'sendmail exited with code {}'.format(status)
        else:
            message = ''
        super(SendmailError, self).__init__(message=message)
        self.status = status
        self.stdout = stdout
        self.stderr = stderr