Message38607
Logged In: YES
user_id=12800
Sorry to take so long to respond on this one.
RFC 2821 is the latest standard that smtplib.py should
adhere to. Quoting:
[HELO and EHLO] are used to identify the SMTP client to
the SMTP
server. The argument field contains the fully-qualified
domain name
of the SMTP client if one is available. In situations in
which the
SMTP client system does not have a meaningful domain name
(e.g., when
its address is dynamically allocated and no reverse
mapping record is
available), the client SHOULD send an address literal
(see section
4.1.3), optionally followed by information that will help
to identify
the client system.
Thus, I believe that sending the FQDN is the right default,
although socket.getfqdn() should be used for portability.
Neil's patch is the correct one (although there's a typo in
the docstring, which I'll fix). By default the fqdn is
used, but the user has the option to supply the local
hostname as an argument to the SMTP constructor. Since RFC
2821's admonition is that the client SHOULD use a domain
literal if the fqdn isn't available, I'm happy to leave it
up to the client to get any supplied argument right.
If we wanted to be more RFC-compliant, SMTP.__init__() could
possibly check socket.getfqdn() to see if the return value
was indeed fully-qualified, and if not, craft a domain
literal for the HELO/EHLO. Since this is a SHOULD and not a
MUST, I'm happy with the current behavior, but if you want
to provide a patch for better RFC compliance here, I'd be
happy to review it. |
|
Date |
User |
Action |
Args |
2007-08-23 15:10:20 | admin | link | issue497736 messages |
2007-08-23 15:10:20 | admin | create | |
|