tell application "Mail"
set smtp server of account "acctName" to smtp server "serverName"
end tell
tell application "Finder"
do shell script "scselect locationName"
end tell
Replace acctName with the name of your account in Mail, change serverName to the name of your already-existing SMTP server in Mail. Replace locationName with the name of the Network location you want to switch to.
You can enter multiple lines of the line that begins with set smtp... for multiple accounts. I created two copies of this script and put them in the Scripts menu: one for work, and one for home (where I'm forced to use my ISP's smtp server). And yes, I know that the network location can be easily changed from the Apple menu. However, I wanted one step, not two.
[robg adds: We've run a few hints about various ways to use scselect.]

