How to make Apple Mail.app to use SOCKS proxy configured by a PAC file For some reasons, I have to use a SOCKS proxy to access Gmail, otherwise, the connection will be blocked.

I tried the global SOCKS agent, and the Mail.app worked fine. Nevertheless, when I turned to use a PAC file to configure system agent automatically, the Mail.app wasn't able to access Gmail.

My questions:


Is it possible to set proxy in Mail.app? That is, Mail.app passes its web traffic to the SOCKS proxy while other apps won't be influenced.
If the answer to the first question is NO, then how to modify my PAC file to make Mail.app possible to access Gmail?


Any clues or suggestions would be appreciated.



More info:

OS version: OS X 10.9.5

Mail.app version: 7.3 (1878.6)

The PAC file:

var domains = {
  "l.google.com": 1,
  "gmail-imap.l.google.com": 1,
  "googlepages.com": 1,  
  "googlesile.com": 1, 
  "google.co.jp": 1, 
  "gaeproxy.googlecode.com": 1, 
  "sshtunnel.googlecode.com": 1, 
  "googleusercontent.com": 1, 
  "goagent.googlecode.com": 1, 
  "google.com": 1, 
  "googlevideo.com": 1, 
  "google.com.hk": 1, 
  "tuite.googlecode.com": 1, 
  "gfwinterceptor.googlecode.com": 1, 
  "gtap.googlecode.com": 1, 
  "googleapis.com": 1
};

var proxy = "SOCKS5 127.0.0.1:1080; SOCKS 127.0.0.1:1080; DIRECT;";

var direct = 'DIRECT;';

function FindProxyForURL(url, host) {
    var lastPos;
    do {
        if (domains.hasOwnProperty(host)) {
            return proxy;
        }
        lastPos = host.indexOf('.') + 1;
        host = host.slice(lastPos);
    } while (lastPos &gt;= 1);
    return direct;
}
Try go to Network Preferences, select the network you want to set, and go to Advanced -> Proxies. Then, set both Automatic Proxy Configuration and SOCKS proxy. It works for me.

FYI, if you're using Shadowsocks the PAC would probably be http://127.0.0.1:8090/proxy.pac.