Has anyone successfully tunneled IMAP and SMTP from Mac's Mail.app over a HTTP proxy to a remote host and onto Gmail?

So far, I've been able to tunnel the IMAP connection, however SMTP isn't working. I used Wireshark and it looks like Mail.app isn't accessing standard smtp.gmail.com and is using some IPv6 addressing.

My setup so far Home Mac:

  • ddns.net publishing dynamic IP
  • sshd enabled and port forwarded via router

Remote system behind firewall:

  • sudo ./ptunnel.py -d -p www-proxy.company.com:80 993:imap.gmail.com:993 587:smtp.gmail.com:587 25:smtp.gmail.com:25
  • /etc/hosts

    imap.gmail.com localhost smtp.gmail.com localhost

I tested using 'telnet localhost 993' and 'telnet localhost 587' that IMAP and SMTP are correctly tunneled by viewing output. Unfortunately, when sending SMTP mail a connection can't be established and Wireshark doesn't see any activity on port 587 for localhost. I noticed other activity on 587, however for an IPv6 address.

Appreciate any insight folks may have here on making this work. I'd like to do it for the FaceTime and iMessenger ports as well.


Your Answer

By clicking "Post Your Answer", you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.