[issue11281] smtplib: add ability to bind to specific source IP address/port

Paulo Scardine report at bugs.python.org
Tue Feb 22 19:33:40 CET 2011


Paulo Scardine <paulo at scardine.com.br> added the comment:

My first idea was to make the argument a tuple to match socket.create_connection(), but SMTP uses host and port arguments, for consistency it's better havin separate source_ip and source_port arguments. As a side effect, it makes easier to specify only source_port. 

The submited patch includes tests and updated docstrings; 

At the smtplib.rst, for example:

SMTP(host='', port=0, local_hostname=None[, timeout])

Would be ok to change it like:

SMTP(host='', port=0, local_hostname=None[, timeout], source_ip='', source_port=0)

----------

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue11281>
_______________________________________


More information about the Python-bugs-list mailing list