dimanche 28 décembre 2014

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:



  1. 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.

  2. 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: http://upl.io/p0kjwh (It seems that Apple.SX doesn't support code display, so I upload my PAC file to a code pasting site.)


    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 >= 1); return direct; }







Aucun commentaire:

Enregistrer un commentaire