The browser works through a PAC file. The mail client cannot connect to IMAP. There is no contradiction: the browser and mail client are asking for different services through different configuration interfaces.

IMAP is not an ordinary HTTP fetch. A client needs a route capable of carrying its mail protocol, such as a supported HTTP CONNECT tunnel or SOCKS connection. The proxy also has to allow the destination and port.

Check the mail library's actual support

Current Angus Mail's IMAP provider documents HTTP proxy host, port, and account properties, plus SOCKS-related settings. Use the documentation for the installed provider and protocol. Old advice that JavaMail can never use an HTTP proxy describes a different capability boundary.

A property name that looks plausible is not enough. The secure IMAP protocol can require the corresponding property prefix, and an arbitrary HTTP proxy property used by another Java client is not necessarily read by the mail provider.

PAC discovery is another feature

A browser's PAC URL is configuration data, not the address of an IMAP server or forwarding proxy. Determine the supported proxy route for the mail destination instead of substituting that URL for the mail host.

Then separate the accounts. Proxy credentials authorize the intermediary; the mail account authorizes access to the mailbox. A valid mailbox password cannot repair a rejected CONNECT request.

Keep mail TLS verification enabled through the supported tunnel. If the authorized proxy does not permit the required mail port, request the approved access arrangement. Changing the port label or the proxy scheme cannot make an incompatible or denied connection into an allowed one.

Erthyglow kevrennek