From f01eac2da09aac4132fb52b865d892e2e2c7f6e3 Mon Sep 17 00:00:00 2001 From: "W. Trevor King" Date: Fri, 15 Feb 2013 09:16:39 -0500 Subject: [PATCH] email: Make path to sendmail configurable MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit 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 --- CHANGELOG | 3 +++ rss2email/config.py | 3 ++- rss2email/email.py | 5 +++-- 3 files changed, 8 insertions(+), 3 deletions(-) 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) -- 2.26.2