Send your latest computer dynamic IP to email
I was away from my office PC last week when my Outlook email account reached 60 MB (ONLY). So I no longer can receive or send any new mail from my Windows Mobile phone. Luckily Gmail is always there to save the day.
As usual, I logged in my PC into my company’s Workforce Portal (a generic name would be Virtual Private Network) which is using Juniper Network Connect. Through Workforce Portal we are virtually inside the office.
My intention was to remote into my office PC so that I could archive all the old mails ( Yes, my fault also for not using auto archive). I launched the mstsc.exe (Remote Desktop Connection) at the Run/Start Menu and just clicked the connect on the IP address already shown there. And then the nightmare came…It was no longer my IP address! I could not connect!
Not again…My office computer’s IP address was flushed again by the DHCP server!
So, after I start to find a solution on how can I keep myself update to the computer dynamic IP address which so that whenever I want to use the Remote Desktop, I will always know the current IP address.
I tried to find dedicated applications in the Internet for that, e.g IP Watcher, Dynamic IP Monitor but those are just not working as intended. The IP Watcher only email the external public IP (My company WAN IP address, or the Internet IP address).,while the Dynamic IP Monitor for whatever reasons give my internal IP address as 0.0.0.0 which is non-sense.
Out of desperation, I need to have my own solution.
IP address will only dynamically change when the PC start, so if I could make a MS-DOS command line script so that at each boot, the computer will send email containg its latest IP address to my Gmail account.
To accomplish that, I need to have an application that can send email with attachment from command line. To do that, all I need is this little piece of applicate, called SendEmail.
Download the file and extract it to your C: drive.
Open Notepad, write the following code:
SendEmail.exe -f FROMADRESS -t TOADDRESS -u SUBJECT -m MESSAGE -s SMTPSERVER -a C:\ipaddress.txt
Save the file as filename.bat maybe at C:\
Create this file shortcut in your Start Menu/Startup so that this script will launch each time when your PC boots.
The first command (ipconfig >C:\ipaddress.txt) is actually to copy your IP configuration into a file called ipaddress.txt in yout C:\
The next command is to send this attachment to your email using the SMTP server. So make sure you know the SMTP server IP address of its DNS name.
So, now each time my computer boot with a new IP address, I will have its IP address in my Gmail account. Now I can use the Remote Desktop from anywhere without worrying on the dynamic IP address anymore.
11 Comments »