Jump to content
Sign in to follow this  

Check Wan IP with Email Notification

Recommended Posts

Been looking for something like this for a few years now. Never could find a "simple" program to alert me when a customer's ip address changes. I think this is about as simple as it gets (until Autoit has it's own built in smtp engine that is). Got the idea from Wb-Freekill's PCinfo script.

Forum topic

Basically, it checks the file wanip.txt (created after first use of the script) and stores the ip address found in it.

It then checks whatismyip.org for the ip address, and plugs it into wanip.txt.

If the ip's are the same, it exits.

If they're different, it uses blat to send an email with the contents of wanip.txt (the ip address).

$To = IniRead(@Homedrive & "wanip.ini", "Settings", "To", "")
$From = IniRead(@Homedrive & "wanip.ini", "Settings", "From", "")
$SMTP = IniRead(@Homedrive & "wanip.ini", "Settings", "SMTP", "")
$Site = IniRead(@Homedrive & "wanip.ini", "Settings", "Site", "")

$FILE = FileOpen(@Homedrive & "wanip.txt", 0)
$LINE1 = FileReadLine($FILE)

$IP = URLDownloadToFile ($Site, @Homedrive & "wanip.txt")

$FILE = FileOpen(@Homedrive & "wanip.txt", 0)
$LINE = FileReadLine($FILE)
FileClose(@Homedrive & "wanip.txt")

If $Line1 = $Line Then
RunWait(@ComSpec & " /c " & 'blat wanip.txt -to ' & $To & ' -f ' & $From & ' -server ' & $SMTP, "", @SW_HIDE)


Here's the wanip.ini file format:


You need blat in the same folder as the script and ini file:


To get around needing authentication on the mail server, I used my own mail server (the one that hosts my email). Since the email is going to an account on it, it doesn't ask for authentication (ie, it's not trying to relay).

I'd like to have blat use a different subject. It's not necessary, but it would just look nicer. But when I try to put in a subject (-subject "Here's my new ip"), it won't email. Maybe autoit doesn't like the quotes?

Let me know what you guys think or if any of the code could be tightened up.

I hope some of you out there find this useful.

Share this post

Link to post
Share on other sites

Nice one.

I actually wrote the same thing (sorta) in PHP. Supports DNS registering, FTP, and email.

Check this out:



Odd...I called my log file wanip.txt too


FYI: I just noticed the http://whatismyip.org...I've been hosting my own WAN IP display at http://www.shrum.net/getip.php

Edited by sshrum

Sean Shrum :: http://www.shrum.net

All my published AU3-based apps and utilities

'Make it idiot-proof, and someone will make a better idiot'


Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.

  • Create New...