unixip-addressipdynamic-ip

Emailing about IP changes


You can choose any language. I am interested to know the simplest solution. How can you get your comp's IP and email it?


Solution

  • Linux bash command line:

    /sbin/ifconfig eth0 | grep 'inet addr' | cut -d: -f2 | cut -d ' ' -f1 | mail -s 'My IP address' someone@example.com