Using postfix in C / detecting IP addresses
So I'm setting up Ubuntu server 8.04 on a dynamic IP - and I'm writing a script that needs to send me an email whenever the IP changes. So I'm frantically researching the cleanest ways to do this in C - but if you can make some recommendations, you'll probably save me a lot of time and I could avoid going down the wrong path.
1. I'm behind a router - how can I find the routers WAN address? I know I'm 192.168.1.100 and it's 192.168.1.1, but how can I tell what my address is to the outside?
2. I see postfix is the default MTA in Ubuntu... I can't seem to get it work though. I try executing it from the command line and from my program through system(), and each time the program ends with no message, and I never receive an email from the other end. I'm guessing I have it configured wrong - I have check with my ISP and they do allow mail servers. Any thoughts?
I'm aware that Google results for both these topics are numerous - but they all seem to be very low quality, and I'm wary of "trying" any more solutions presented because none of them have worked so far.