My Digital Story

What’s a small world…

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:

ipconfig >C:\ipaddress.txt
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.

16/01/2009 - Posted by abuhawa | Windows XP troubleshootings | , , , , | 6 Comments

6 Comments »

  1. good god your solution is the EXACT one i needed man .. tks
    let me know if u have any interesting CLI scripts or techniqs or even programs in future ^^

    Comment by Henry | 13/02/2009

  2. Hi, is it possible to create a script to check my ip address every X minutes and send it to my email? Thanks

    Comment by oldSAP | 07/03/2009

  3. Thx for the script and idea’s i will use them and add some.

    Comment by Mikael | 26/05/2009

  4. Assalamualaikum,

    Terimakasih… my wife’s office block my home network IP camera using websense. The only way to do it is to use ip adress. This is what I am looking for.. thanks man..

    Comment by Amin | 15/06/2009

  5. Hello This didn’t work for me. I download the sendmail file on my c drive C:\sendmail> but can’t run the sendmail Pl file. I created the filename.bat file and configure it to my info but i think something is missing. Can i get a walk through?

    Comment by Pepie | 20/09/2009

  6. They recorded three separate versions of the single; the one recorded on X&Y was based on an early cut of the song. ,

    Comment by Loy31 | 11/10/2009


Leave a comment