Get Internet IP address and send email notification

Source: Internet
Author: User
Tags response code

Name: IP address notifier
Download the latest version (if you have any questions during use, please send me an email or leave a message here (csdn my blog .)

Version: 1.26 official version
Author: Que rongwen-Que's C ++ Studio
Date: 2010/11/10
Copyright: copyright owned by the author, free to use. If you need source code (Visual Studio 2008), please contact the querw@sina.com to buy.

Purpose
Obtain the Internet IP address of the Local Machine and send the IP address to the specified mailbox. The network connected by proxy is not supported.

Principles
If the local machine is on the public network or is directly connected to the public network through dialing, the IP address of the local machine is an Internet IP address. However, if a computer is in the LAN and connected to the Internet through a gateway/router,
You must use an external server to obtain the Internet IP address of this website. In this world, many web pages will display the visitor's IP address. This is the IP address notifier V1.0 Beta.
IP address information on the webpage.

Instructions for use

1. configuration page

(1) Automatic startup: write registry "HKEY_CURRENT_USER/Software/Microsoft/Windows/CurrentVersion/Run". If this option does not work on your computer,
It may be because the current user does not have the permission to read and write the registry, or the request is intercepted by a third-party program. For example, 360. If this option is valid, the program will be minimized after Windows is started.

(2) automatically start after running the program: automatically capture IP addresses after running the program.

(3) always report IP Address: If this option is not selected, the system will send an email notification or run the specified command only when the IP address changes. this option can be selected to make the program report each time the IP address is captured successfully. (send
Email or run the specified command .)
Suggestion: If you want to select this option, set the "detection interval" to at most 30 minutes. Too frequent email sending may make your email considered as spam.

(4) Enable bubble tip: When this option is selected, the program displays a bubble prompt in the system tray area while reporting the IP address.

(5) IP Source: a webpage that provides an IP address. It must start with "http.

(6) IP address format: IP address location in the web page source code. the IP Format always requires at least one '*' to represent an IP address string (equivalent to a wildcard). The program extracts an IP address string using this format string, while
Not the source code of the entire webpage.
'*' Indicates the IP string, and '*' indicates the string cannot exceed 512 characters. '/R' indicates the carriage return'/N' indicates the newline '/t' indicates the TAB.

The following IP address sources and formats are available in the test:
Source: http://whatismyipaddress.com/format: <span class = "ip blue"> * <! -- Contact us before using (default setting of the Program)
Source: http://www.ipchicken.com/format: Address:/r/n * </font> </td>
Source: http://www.ip138.com/ip2city.asp format: your IP address is: [*]

In fact, the valid IP source is far from the above three, as long as you fill in the correct format string, almost all web pages that can display IP addresses can become the IP source of this program.

(7) Test IP Source: You can test the Entered IP source and format without modifying the configuration. The test result is displayed on the log page.

(8) after detecting that the IP address is changed, send an email notification: If the IP address detected by the program changes, an email will be sent.
The following parameters are email-related. please note that when entering the sender and recipient, please fill in the mail address xx@xx.com directly, instead of using an address similar to with, such as "John <xx@xx.com>"
In addition, because all configuration information is saved in settings. ini in the program directory, the password you entered is insecure.
The IP address notifier V1.0 Beta does not support SMTP mailboxes using secure sockets, such as gmail.com. We apologize for any inconvenience caused.

The SMTP servers in the email address are smtp.sina.com.cn and smtp.163.com at 2010/11/10.

(9) after detecting that the IP address is changed, store the file and run the command with the parameter: If this option is selected, when the program reports the IP address, the IP address is stored in the current directory as a file name
A unicode text file of "IP. TXT", and the file path is a parameter to call the specified command. If the specified command is empty, only the file is stored.

2. Log page: displays the output information during the running of the program. Up to 30000 characters can be saved. If it exceeds the limit, the first 200 rows will be deleted.

3. Home Page

(1) Clear logs.

(2) Clear the recorded IP Address: after the program reports that the IP address is successful (the IP address is reported as successful in the following cases: the email is sent successfully or the command is run successfully, or you do not need to report the IP address. (8)
And 1. (9) both options are not selected .) the IP address is recorded and displayed as the window title and bubble prompt. if the report fails, for example, if only the mail option is selected, and the mail fails to be sent.
The IP address displayed by the program is not the latest IP address, but the IP address that was successfully reported last time. That is to say, in this case, the results displayed by the program are consistent with those displayed by the mail. "Clear recorded IP addresses"
The button will set this value to 0.0.0.0.

(3) run/stop: after running, the IP address is immediately captured and the timer is set. when it is disabled, only the timer will be canceled. If the program is capturing IP addresses or sending emails, it will continue to complete.

(4) Exit.

---------------------------

 

The program running interface is as follows:

 

 

 

 

--------------------

 

Version update description

 

2010-11-13 V1.01 Beta

 

Fixed: If only email notification is selected, once the email fails to be sent, the IP address will be saved to the local device. In this case, the user will not be able to receive the latest IP address notification email.

Corrected: the IP Source of the UTF-16 Code cannot be correctly identified.

Fixed: the risk of stack overflow occurs when character encoding is converted inside the program. Now heap allocation is used.

Added: IP sources that can now recognize UTF-8 encoding.

Update Description: The bubble prompt is only effective in Windows XP and later versions.

 

Official version V1.02

 

Update Description: "Always report IP Address" is changed to "no change in IP address Report", which is easier to understand.

 

V1.04 official version

Update: enable the new log system, remove it, and modify some log text.

New: the SMTP password is now stored in the configuration file in the form of ciphertext. (the ciphertext is obtained after the original password is transformed into DES and BASE64 .) (After the update, you need to re-enter the SMTP password .)

Update: test the content modification of the email and the IP address change notification email to display the differences between the email and the real IP address notification email.

UPDATE: The email subject contains the host name.

Fixed: Use the New User-Agent to send HTTP requests to obtain more IP source support. user-Agent: IPNotifier/1.04 (compatible; MSIE 8.00; Firefox 3.6; U; Windows ;)

Add a tested IP Source:
Source: http://www.showipaddress.com/format:

Source: http://www.ipaddresslocation.org/format: <span class = "myipaddress"> & nbsp;/r/nb/r/n */r/n309e/r/n </span>
Source: http://www.find-ip-address.org/format: IP Address Lookup-IP Finder for My IP (wan ip) * </div> </TD>
Source: http://www.123myip.co.uk/format:

Source: http://www.ipaddressworld.com/format: <FONT face = "Verdana, Arial, Helvetica, Sans-serif" size = + 6> * </FONT>

If IPNotifier cannot identify the source you need, contact the querw@sina.com
(IPNotifier reads IP addresses by analyzing the source code of the Web page. If the IP source uses a script or redirection, the read will fail .)

 

V1.22 official version

Corrected: the IP source using chunked encoding can be correctly identified.

Corrected: Source: http://www.ipaddresslocation.org/format corrected to: <span class = "myipaddress"> & nbsp; * </span>

 

Fixed: the array out-of-bounds BUG has been fixed when the maximum source data that can be processed is kb.

 

-------------------------------------------------------------------

Postscript

-------------------------------------------------------------------

 

During debugging, it is found that sometimes the "IP source returns [HTTP 0]" log appears. According to the HTTP protocol, the server response code should be 3 digits, from 1XX to 5XX, 0 is not allowed. this problem has plagued me for a few days, because it is very difficult to reproduce and I can't see any problems from the code. finally, I added several lines of code to save the memory at HTTP = 0 to the file. After a long time, I finally caught a situation where HTTP = 0, after reading the file, we can see that the telecom advertisement is inserted into the response stream, and the response header is changed to a mess. although it has no impact on the program,ConvexChina Telecom!

 

Because the V1.04 version was modified a lot, the version should be upgraded. Therefore, the version was upgraded to 1.2 In the last modification.
After this correction, IPNotifier will come to an end, and I will not update it if there are no major bugs.

 

-------------------------------------------------------------------

 

V1.24 (thanks to fugou)

Update: default IP source changed to: http://www.ip138.com/ip2city.asp format: your IP address is: [*]

New: Now you can customize the content of the notification email. @ HOSTNAME represents the host name, @ OLDIP represents the previous IP address, and @ NEWIP represents the latest IP address.

 

2011-7-29 V1.26 (thanks to fugou and nanchang_key for their suggestions)

New: Now you can customize the notification email subject. @ HOSTNAME represents the host name, @ OLDIP represents the previous IP address, and @ NEWIP represents the latest IP address.

Add: You can now set multiple recipients separated by [,] or [;], for example: [xxx@xxx.com, yyy@yyy.com; zzz@zzz.com]

 

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.