Search code examples
pythonip-addresssmtplib

Python smtplib: bind to specific source IP address in a machine with multiple network interfaces


On a host with multiple network interfaces, is it possible to bind the connect method from the Python smtplib to an specific source address?


Solution

  • No such option - at least not without hacking smtplib.connect() yourself.