[Mailman-Users] Mailman and Courier

Greg Ward gward at mems-exchange.org
Fri Oct 26 00:02:54 CEST 2001


On 25 October 2001, Billy Harvey said:
> The syslog shows:
> 
> Oct 24 21:57:15 maestro courieresmtpd:
> error,relay=::ffff:127.0.0.1,ident="list",msg="554 Syntax error - your
> mail software violates RFC 821.",cmd: RCPT TO:
> 
> The Courier FAQ says this error is usually due to the sending software
> not wrapping the RCPT TO address in <> 's.

Wow, so much for "Be liberal in what you accept, conservative in what
you emit."  ;-)

> Is that the case in Mailman?  Is that an easy fix on my end and if so
> any pointer to what I should change?  Is it something else?

The best way to find out is to use packet-tracing software like
Ethereal.  Ethereal is amazingly cool; just run it for a few seconds
while Mailman is passing a message to your MTA, find a packet from that
connection, and you can reconstruct the whole SMTP session.  Question
answered.

The second-best way is: Use the Source, Luke.  A quick look at
Mailman/Handlers/SMTPDirect.py reveals that Mailman uses Python's
smtplib module.  Specifically, it creates an SMTP object and calls
sendmail() on it.

No wait, it uses Mailman's "custom" version of smtplib.  So let's take a
look in Mailman/pythonlib/smtplib.py for the answer.  Here's a snippet
from the SMTP.sendmail() method:
    for each in to_addrs:
        (code,resp)=self.rcpt(each, rcpt_options)
        if (code <> 250) and (code <> 251):
            senderrs[each]=(code,resp)

So what we're really interested in is the SMTP.rcpt() method; here's the
relevant line from that:
    self.putcmd("rcpt","TO:%s%s" % (quoteaddr(recip),optionlist))

OK, now we need to look at quoteaddr().  This function calls
rfc822.parseaddr() to extracts the bare address from a possibly-hairy
RFC-822 mailbox, eg.
  "John Doe <john (not jane) @ example . net>" -> "john at example.net"
and then wraps the bare address in "<..>".  (Yes, that is a legal
mailbox according to RFC 822.)

The only time quoteaddr() doesn't do that is if it can't parse the
address, *or* if the address is an empty string.

So the answer is: yes, Mailman does emit correct RCPT TO commands, but
it might screw up in pathological cases.  Use Ethereal (or a similar
tool) to see what's going wrong between Mailman and Courier.

        Greg
-- 
Greg Ward - software developer                gward at mems-exchange.org
MEMS Exchange                            http://www.mems-exchange.org




More information about the Mailman-Users mailing list