Click here to Skip to main content
Click here to Skip to main content
Go to top

WAN/Internet IP Emailer Using a GMail Account

, 23 Aug 2008
Rate this:
Please Sign up or sign in to vote.
Obtains a new WAN/Internet IP and sends it to a specified email address using a GMail account.

Introduction

This code checks for internet connectivity, and if internet is available, it obtains the Wan/Internet IP address and sends this IP address to a specified email address using a GMail account.

This application is useful for users who want to control their PCs remotely and their Wan IP address is dynamic. I wanted to control the uTorrent software running on my computer. The problem was that my internet IP address was dynamic and in order to control this software, you need to have the current internet IP address. This application solves this problem by sending me an email containing the latest internet IP address. Now, I can control my software from anywhere.

Using the application

In order to use the application, you must have a GMail account for sending emails to a desired address, and its POP settings should be enabled. Another account can be used, but then you will have to change the SMTP settings in the code. This application is dependent on .NET framework 2.0, so it must be installed on the system.

This application can be selected to run at Windows startup. You can specify the time, 1-60 min, for auto checking the IP, and if there are changes in the WAN IP, then it will send the email. If you want to log the IP addresses, then you can specify a log file. Each new IP address will be appended to the log file.

Note: When this application starts, it goes to the system tray. You have to double click the system tray icon to view the interface of the application.

Code explanation

IsInternetAvailable() checks for the internet connectivity by getting the Google host entry. If this is obtained, then internet is available. GetWanIP() obtains the WAN IP from "http://www.whatismyip.com/automation/n09230945.asp". EmailWanIP(String ip) sends the email with the IP address in the body of the mail.

ProcessWanIP() calls the above three functions and checks whether an email has been sent since the new WAN IP. The email is sent only once when the WAN IP is changes. This function is called by the timer used in the application.

History

  • Version 1.0.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

Share

About the Author

harissarwar
Software Developer Streaming Networks
Pakistan Pakistan
No Biography provided

Comments and Discussions

 
GeneralMy vote of 1 PinmemberMO15ON1-Oct-09 21:54 
AnswerAlternative: Dynamic DNS Pinmemberx-cubed24-Aug-08 15:48 
GeneralRe: Alternative: Dynamic DNS Pinmemberharissarwar25-Aug-08 22:38 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

| Advertise | Privacy | Mobile
Web01 | 2.8.140916.1 | Last Updated 24 Aug 2008
Article Copyright 2008 by harissarwar
Everything else Copyright © CodeProject, 1999-2014
Terms of Service
Layout: fixed | fluid