email: Make path to sendmail configurable
authorW. Trevor King <wking@tremily.us>
Fri, 15 Feb 2013 14:16:39 +0000 (09:16 -0500)
committerW. Trevor King <wking@tremily.us>
Fri, 15 Feb 2013 14:22:15 +0000 (09:22 -0500)
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 <wking@tremily.us>
CHANGELOG
rss2email/config.py
rss2email/email.py

index a744f5d81c2f54c5525d0d0c1762d09309ef9808..62ba8d28f2e7bf4f436ba8e1a6ecd41ded5660fb 100644 (file)
--- 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.
 
index 775fcd74f06fbcd53dcdd35a79551fa8f6f2f9e4..ebdd73fa2c987c5a31a09213181cef310c54e269 100644 (file)
@@ -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
index 626acda7e7fa1553653e7c111812a13fec8ef9d1..bbbfb65d41be4346caa657c5b58bab2aca7ccf5b 100644 (file)
@@ -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)