Click here to Skip to main content
13,298,655 members (46,206 online)
Click here to Skip to main content
Add your own
alternative version


19 bookmarked
Posted 23 Aug 2008

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.


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 "". 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.


  • Version 1.0.


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


About the Author

Software Developer Streaming Networks
Pakistan Pakistan
No Biography provided

You may also be interested in...


Comments and Discussions

GeneralMy vote of 1 Pin
MO15ON1-Oct-09 22:54
memberMO15ON1-Oct-09 22:54 
AnswerAlternative: Dynamic DNS Pin
x-cubed24-Aug-08 16:48
memberx-cubed24-Aug-08 16:48 
GeneralRe: Alternative: Dynamic DNS Pin
harissarwar25-Aug-08 23:38
memberharissarwar25-Aug-08 23:38 

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

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

Permalink | Advertise | Privacy | Terms of Use | Mobile
Web03 | 2.8.171207.1 | Last Updated 24 Aug 2008
Article Copyright 2008 by harissarwar
Everything else Copyright © CodeProject, 1999-2017
Layout: fixed | fluid