First half of the solution: A cron job that fires off every morning to email my IP address to my address at work at 6:00am:
/Users/me/scripts/getip | mail -s "my IP at home" myemail@work.comSecond half of the solution: Here's an AppleScript which I attach to a rule in Mail.app. For the rule's conditions, set the Subect field to match on a keyword like "sendmemyipaddress." You can use your own keyword, of course. In the Actions section, have it perform an AppleScript, and point it to a compiled copy of the following script:
on perform_mail_action(info)
set my_ip to (do shell script "/Users/me/scripts/getip")
set my_dest to "email@work.com"
set my_subj to "My IP at home"
tell application "Mail"
set selectedMessages to |SelectedMessages| of info
set theRule to |Rule| of info
repeat with eachMessage in selectedMessages
activate
GetURL ("mailto:" & my_dest & "?subject=" & my_subj ¬
& "&body=" & my_ip)
send outgoing message 1
end repeat
end tell
end perform_mail_action
The purpose behind this is to have a backup in case my provider changes my ip AFTER my mac has emailed my ip address to work -- I just have to send myself an email with the subject "sendmemyipaddress."
With a little imagination, you can adapt this script to things like X11 home automation. Say you are on vacation and you'd like to turn your house lights on, well, just email your Mac at home. One caveat is you have to keep Mail.app launched and set to pull mail from your provider every so often (ie not on Manual).
Credits: All props go to Jerry LeVan for his excellent perl script to fetch the public IP from a Linksys cable router (the "getip" script noted aboev), and to jbs and grrl-geek for their help in getting my thick skull around AppleScripting Mail! Thanks!
[robg adds: You can also use a service like dyndns.org to give yourself a functional hostname. By running the dyndns client, your machine will automatically inform the network of any changes in its IP address. However, the above solution is still interesting in light of the potential to use inbound email to have your machine do certain things.]

