bbottema/simple-java-mail

Add support for Proxy (HTTP, SOCKS, authenticated)

bbottema opened this issue · 1 comments

JavaMail only supports anonymous SOCKS proxy.

The only way to add this capability is by incorporating a SOCKS server into Simple Java Mail: it would be started when an email is being sent through Mailer.sendMail() and accepts the anonymous proxy connection from JavaMail on localhost and relays it to a proper proxy by also including a proxy client in Simple Java Mail which can connect to any proxy (HTTP, SOCKS, anonymous and authenticated).

So:

Mailer.sendMail() -> JavaMail Transport.send() (supports only anonymous SOCKS) -> Simple Java Mail temp proxy (anonymous SOCKS) -> Simple Java Mail proxy client -> the real proxy through which you want to go (HTTP, SOCKS, anonymous and authenticated)


But I don't want to balloon this library into the megabytes, because some open source proxy library included guava and netty and whatnot. Simple Java Mail is to remain a sleak library that includes everything in itself (by using the maven shade plugin).

I managed to adapt sockslib to a bare minimum and created a proxy bridge that does the job for authenticated SOCKS proxy support. HTTP support won't work, I think as that is a specific port and protocol.

Will be included in release 4.0.0