diff -r 81ab5ffa6863 roundup/configuration.py --- a/roundup/configuration.py Wed Apr 24 23:46:57 2013 -0400 +++ b/roundup/configuration.py Sat Jun 08 23:41:58 2013 -0400 @@ -675,6 +675,9 @@ "This domain is added to those config items if they don't\n" "explicitly include a domain.\n" "Do not include the '@' symbol."), + (Option, "sendmail", NODEFAULT, + "SENDMAIL binary to use (optional)", + ["SENDMAIL"],), (Option, "host", NODEFAULT, "SMTP mail host that roundup will use to send mail", ["MAILHOST"],), diff -r 81ab5ffa6863 roundup/mailer.py --- a/roundup/mailer.py Wed Apr 24 23:46:57 2013 -0400 +++ b/roundup/mailer.py Sat Jun 08 23:41:58 2013 -0400 @@ -2,7 +2,7 @@ """ __docformat__ = 'restructuredtext' -import time, quopri, os, socket, smtplib, re, sys, traceback, email +import time, quopri, os, socket, smtplib, re, sys, traceback, email, subprocess from cStringIO import StringIO @@ -265,6 +265,9 @@ if not sender: sender = self.config.ADMIN_EMAIL + + sendmail=self.config.SENDMAIL + if self.debug: # don't send - just write to a file, use unix from line so # that resulting file can be openened in a mailer @@ -273,6 +276,28 @@ open(self.debug, 'a').write('%s\nFROM: %s\nTO: %s\n%s\n\n' % (unixfrm, sender, ', '.join(to), message)) + elif sendmail: + # open sendmail like process pass to on the command line + # write the message to stdin and then close stdin to + # indicate the message is done + # get exit code and report output/error and raise error + # + # If sendmail returns code 75 when used this way + # + # #define EX_TEMPFAIL 75 + # /* temp failure; user is invited to retry */ + # + # ignore the error since the email has been queued and + # we have suceeded as far as the submission is concerned. + mailer = subprocess.Popen([sendmail, ', '.join(to)], stdin=subprocess.PIPE, stderr=subprocess.PIPE) + print >>mailer.stdin, message + mailer.stdin.close() + if mailer.wait(): + if mailer.returncode != 75: + mailer_err = mailer.stderr.read(2048) + raise MessageSendError("Error: couldn't send email: " + "%s returned %s - %s"%(sendmail, + mailer.returncode, mailer_err)) else: # now try to send the message try: