You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
smtplib does not fully support IPv6 in EHLO #47711
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
assignee=Noneclosed_at=Nonecreated_at=<Date2008-07-28.22:08:43.930>labels= ['type-bug', '3.8', 'expert-email', '3.10', 'library', '3.9']
title='smtplib does not fully support IPv6 in EHLO'updated_at=<Date2020-11-11.00:41:13.914>user='https://bugs.python.org/dmorr'
On an IPv6-only machine, smtplib does not send an IPv6 address in the
EHLO. It sends "EHLO [0.0.0.0]" instead. For example, on a v6-only
network with stateless autoconfiguration enabled (a common
configuration), smtplib will show this error.
Further, SMTP's __init__() method tries to determine the value of EHLO
parameter before the socket is established. But it can't know what
value to use before the socket is setup (e.g., should it use a
hostname, a v4 address literal, or a v6 address literal).
The attached patch moves the self.local_hostname processing into the
connect() method, and updates it to use IPv6-aware resolver interfaces.
I'm not sure how to best write a unit test for this. The patch should only be invoked if the client doesn't have a name-served hostname and has IPv6 enabled. Also, there are several IPv4-isms in the smtplib tests.
You might want to take a look at Lib/test/test_ftplib.py which contains IPv6 tests including the necessary logic to decide whether or not running them.
Activity
dmorr commentedon Jul 28, 2008
On an IPv6-only machine, smtplib does not send an IPv6 address in the
EHLO. It sends "EHLO [0.0.0.0]" instead. For example, on a v6-only
network with stateless autoconfiguration enabled (a common
configuration), smtplib will show this error.
Further, SMTP's __init__() method tries to determine the value of EHLO
parameter before the socket is established. But it can't know what
value to use before the socket is setup (e.g., should it use a
hostname, a v4 address literal, or a v6 address literal).
The attached patch moves the self.local_hostname processing into the
connect() method, and updates it to use IPv6-aware resolver interfaces.
BreamoreBoy commentedon Jul 4, 2010
I intended testing this but the patch file appears to have a dangling else at the bottom, or am I missing something?
dmorr commentedon Jul 5, 2010
You're right. My mistake when I made the patch. I've attached a new one without the trailing else
BreamoreBoy commentedon Jul 6, 2010
Ran test_smtplib.py for Python 2.7 and 3.1.2 on Windows Vista all tests passed.
bitdancer commentedon Jul 6, 2010
The patch still needs unit tests.
dmorr commentedon Jul 12, 2010
I'm not sure how to best write a unit test for this. The patch should only be invoked if the client doesn't have a name-served hostname and has IPv6 enabled. Also, there are several IPv4-isms in the smtplib tests.
giampaolo commentedon Jul 12, 2010
You might want to take a look at Lib/test/test_ftplib.py which contains IPv6 tests including the necessary logic to decide whether or not running them.
test to see if we can get IPv6 support