From: W. Trevor King Date: Fri, 15 Feb 2013 14:16:39 +0000 (-0500) Subject: email: Make path to sendmail configurable X-Git-Tag: v3.2~7 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=f01eac2;p=rss2email.git email: Make path to sendmail configurable For example, Azer Koçulu has an rss2email fork that uses msmtp [1]. [1]: https://github.com/azer/rss2email Signed-off-by: W. Trevor King --- diff --git a/CHANGELOG b/CHANGELOG index a744f5d..62ba8d2 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,3 +1,6 @@ +v3.2 (unreleased) + * Added sendmail configuration option. Change this if you want to use an alternative, sendmail-compatible mailer. + v3.1 (2013-02-14) * Import __url__, __author__, and __email__ in rss2email.error, which fixes bugs in formatting a number of errors. diff --git a/rss2email/config.py b/rss2email/config.py index 775fcd7..ebdd73f 100644 --- a/rss2email/config.py +++ b/rss2email/config.py @@ -150,8 +150,9 @@ CONFIG['DEFAULT'] = _collections.OrderedDict(( ### Mailing # True: Use SMTP_SERVER to send mail. - # False: Call /usr/sbin/sendmail to send mail. + # False: Use sendmail (or compatible) to send mail. ('use-smtp', str(False)), + ('sendmail', '/usr/sbin/sendmail'), # Path to sendmail (or compatible) ('smtp-server', 'smtp.yourisp.net:25'), ('smtp-auth', str(False)), # set to True to use SMTP AUTH ('smtp-username', 'username'), # username for SMTP AUTH ('smtp-password', 'password'), # password for SMTP AUTH diff --git a/rss2email/email.py b/rss2email/email.py index 626acda..bbbfb65 100644 --- a/rss2email/email.py +++ b/rss2email/email.py @@ -237,11 +237,12 @@ def sendmail_send(sender, recipient, message, config=None, section='DEFAULT'): if config is None: config = _config.CONFIG message_bytes = _flatten(message) + sendmail = config.get(section, 'sendmail') _LOG.debug( - 'sending message to {} via /usr/sbin/sendmail'.format(recipient)) + 'sending message to {} via {}'.format(recipient, sendmail)) try: p = _subprocess.Popen( - ['/usr/sbin/sendmail', '-f', sender, recipient], + [sendmail, '-f', sender, recipient], stdin=_subprocess.PIPE, stdout=_subprocess.PIPE, stderr=_subprocess.PIPE) stdout,stderr = p.communicate(message_bytes)