On Apr 23, 2005, at 1:52 PM, Stephen Warren wrote:

> Amitai Schlair wrote:
>> So I set SENDMAIL_PROGRAM = '/usr/pkg/bin/pymsgauth-mail' in  
>> ~/.tmda/config and figured it'd Just Work. But when I try to send  
>> a test message to myself, an error bubbles up to my mail client  
>> saying it failed to send. The pymsgauth log says:
>> 18 Apr 2005 13:13:29 Fatal:  failed sending mail (mail command ['/ 
>> var/qmail/bin/qmail-inject', '-A', '-i', '-f',  
>> '[EMAIL PROTECTED]', '--', '[EMAIL PROTECTED]'] exited 100, no  
>> signal, err: "qmail-inject: illegal option -- i")
>> 18 Apr 2005 13:13:29 Traceback:18 Apr 2005 13:13:29   File "/usr/ 
>> pkg/share/pymsgauth/pymsgauth.py", line 295, in send_mail
>>     raise DeliveryError, 'mail command %s exited %s, %s%s' \
>
> Postfix's "man sendmail" says this about -i:
>
> -i When reading a message from standard input, don“t treat a line
>    with only a . character as the end of input.
>
> So, it makes sense to use this option. The strange thing is, I  
> previously used qmail with TMDA (and no doubt many people still  
> do), so it's strange that qmail-inject doesn't like this option.  
> That said, I don't recall if I had MAIL_TRANSPORT set to smtp or  
> sendmail...
>
> I see from this copy of the qmail-inject manual page:
>
> http://resin.csoft.net/cgi-bin/man.cgi?section=8&topic=qmail-inject
>
> That -i is not a valid option (the behaviour specified by -i is the  
> default). In the short term, your best bet is tow write a wrapper  
> script that pymsgauth invokes as the sendmail program. This wrapper  
> script should remove -i from the command-line, then exec the real  
> qmail-inject.
>
> Longer term, perhaps TMDA should be taught about the qmail-inject  
> interface, in addition to sendmail.

Here's a quick-and-idiotic patch that fixes the above problem on my  
system. (N.B.: I don't know the first thing about Python, so I  
specifically did the simplest thing that fit into the existing  
control structure, even though that may not be the best way.)

--- TMDA/Util.py.orig   2006-10-29 22:07:56.000000000 -0500
+++ TMDA/Util.py
@@ -596,7 +596,13 @@ def sendmail(msgstr, envrecip, envsender
             Defaults.MAIL_TRANSFER_AGENT in ('postfix', 'qmail') and \
             Defaults.MAIL_TRANSPORT == 'sendmail':
          envsender = ''
-    if Defaults.MAIL_TRANSPORT == 'sendmail':
+    if Defaults.MAIL_TRANSPORT == 'sendmail' and \
+           Defaults.MAIL_TRANSFER_AGENT == 'qmail':
+        # skip "-i" for qmail-inject (invalid option, and it's the  
default)
+        cmd = (Defaults.SENDMAIL_PROGRAM,
+               '-f', envsender, '--', envrecip)
+        pipecmd(cmd, msgstr)
+    elif Defaults.MAIL_TRANSPORT == 'sendmail':
          # You can avoid the shell by passing a tuple of arguments as
          # the command instead of a string.  This will cause the
          # popen2.Popen3() code to execvp() "/usr/bin/sendmail" with
_________________________________________________
tmda-workers mailing list ([email protected])
http://tmda.net/lists/listinfo/tmda-workers

Reply via email to