Do No Use This
I’ve noticed that when i run the script occasionally it loses all messages from the inbox and the sent box.
Ok the other day i was using ssh’s dynamicForward option combined with the system socks proxy setting on localhost (this should tunnel all traffic through the ssh tunnel and work out the appropriate protocol on the other end.) The only application that i’ve found that doesn’t like this is Mail.app.
After some searching i found that others have been complaining about this since 10.1 . This is really quite poor on apples behalf. So the only way i could think of arround this was to use the localForward. but this means that when you want to tunnel it you will have to go into mail and change the ports and server names and so forth.
so i came up with this function / script to make this very simple.
on accountModify(accName, ServerName, incomingPort, sslOn, smtpString)
tell application "Mail"
tell account accName
set server name to ServerName
set port to incomingPort
set uses ssl to sslOn
end tell
set smtp server of account accName to smtp server smtpString
end tell
end accountModify
set buttonTunnel to "Tunnel"
set buttonNormal to "Normal"
set result to display dialog "What settings would you like to user with mail" buttons {buttonTunnel, buttonNormal}
set theButton to button returned of result
if theButton is equal to buttonTunnel then
-- set the servers to localhost and change ports
accountModify("accountName", "localhost", 1110, false, "localhost:user")
else
-- set it back to default
accountModify("accountName", "mail. myisp.com", 995, true, "mail. myisp.com.au:User")
end if
and my ~/.ssh/config file looks like this
Host myMacMini
User kim
Port 12222
IdentityFile ~/.ssh/id_mini
HostName my.mac.minis.url.com
LocalForward 1110 mail.myisp.com:110
LocalForward 25555 mail. myisp.com:25
so now all i do is:
open terminal and type " ssh myMacMini "
run my script and click tunnel
and all my mail is securly running through to my home then to myisp.
and when i’m done i just run my script again and click normal and everything is normal again