CVS: tmda/TMDA Util.py,1.110.2.3,1.110.2.4
"Jason R. Mastaler" <[email protected]> Wed, 18 Feb 2004 13:05:59 -0800
| Newsgroups | gmane.mail.spam.tmda.cvs |
|---|---|
| Message-ID | <[email protected]> |
Update of /cvsroot/tmda/tmda/TMDA
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv3502/TMDA
Modified Files:
Tag: release-1-0
Util.py
Log Message:
Looking through the CVS history, I see two more problems that I forgot
about. Courier and some versions of Postfix will refuse an SMTP
transmission when MAIL FROM is an empty string. Also, some old
versions of Postfix cannot handle "sendmail -f <>".
So, if you boil it all down, to send mail with a null envelope sender,
the string '<>' should be used in all cases except for the following,
where an empty string should be used instead:
When MAIL_TRANSPORT is 'sendmail' *AND* MAIL_TRANSFER_AGENT is either
'postfix' or 'qmail'.
I really hope this is the last time we have to deal with this
discrepancy.
Index: Util.py
===================================================================
RCS file: /cvsroot/tmda/tmda/TMDA/Util.py,v
retrieving revision 1.110.2.3
retrieving revision 1.110.2.4
diff -u -r1.110.2.3 -r1.110.2.4
--- Util.py 18 Feb 2004 19:09:35 -0000 1.110.2.3
+++ Util.py 18 Feb 2004 21:05:56 -0000 1.110.2.4
@@ -565,15 +565,26 @@
envsender is the envelope sender address.
"""
import Defaults
- # Exim/Sendmail both need '<>' but not '' to send mail with a null
- # envelope sender address. Postfix/qmail on the other hand need
- # '' instead of '<>'.
+ # Sending mail with a null envelope sender address <> is not done
+ # the same way across the different supported MTAs, nor across the
+ # two mail transports (SMTP and /usr/sbin/sendmail).
+ #
+ # The most common method is to use the string '<>'. There are two
+ # exceptions where an empty string must be used instead.
+ #
+ # 1) When running qmail/courier and using the sendmail transport.
+ # qmail munges the envelope sender address into <"<>"@domain.dom
+ # if "sendmail -f <>" is used.
+ #
+ # 2) When running Postfix and using the sendmail transport.
+ # Old versions of Postfix apparently also have trouble with
+ # "sendmail -f <>", though Postfix 2.0.x does not.
if envsender == '':
- if Defaults.MAIL_TRANSFER_AGENT in ('sendmail', 'exim'):
- envsender = '<>'
- elif envsender == '<>':
- if Defaults.MAIL_TRANSFER_AGENT in ('qmail', 'postfix'):
- envsender = ''
+ envsender = '<>'
+ if envsender == '<>' and \
+ Defaults.MAIL_TRANSFER_AGENT in ('postfix', 'qmail') and \
+ Defaults.MAIL_TRANSPORT == 'sendmail':
+ envsender = ''
if 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