I'm doing this, in Ruby 2.6:
require 'net/smtp'
Net::SMTP.start('smtp.gmail.com', 457).do |smtp|
smtp.helo('gmail.com')
end
Now I want to do exactly the same, but over SOCKS4/5 proxy. I can't find anything in the documentation.
Looking at the source of Net::SMTP it would seem like it doesn't have built-in support for SOCKS proxies.
A couple of ideas:
tcp_socket method to use SOCKSSocket instead of TCPSocket.SOCKSSocket in pure Ruby (connecting through SOCKS4 isn't too hard, SOCKS5 is slightly more complicated, see this example for reference) or find an existing implementation (although I haven't been able to find one).If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With