Binding to a local address in Net::SMTP


#1

For TCPSocket, I know it’s possible to specify the local IP address if
you want to:

socket = TCPSocket.new(remote_addr, remote_port, local_addr, local_port)

BTW I found this by looking in the source code, since every document I
was referencing only showed the first two arguments.

I am mailing from a host with multiple IP addresses, and I’d like to
be able to specify the local address when I open a connection with
Net::SMTP. Looking at the source, I don’t see any way to do this. I’m
thinking about modifying Net::InternetMessageIO.open (1.8.2) or
old_open (1.8.4) so that it calls TCPSocket.new with the four
arguments, rather than two.

Has anyone had this same issue and created such a workaround? Thanks
for any help.

Cheers,
Jim