Here is my finished solution using applescript.
If it is of use to anyone else please feel free to use/improve it.
global OLD_IP
global Current_IP
global IP_text
set OLD_IP to ""
set Current_IP to ""
set Test_text to ""
---on run get the current external IP address & set it as the Base IP to compare to
do shell script "curl -s checkip.dyndns.org"
set Pub_IP to result
set OLD_IP to Pub_IP as string
---show the address
display dialog "IP is: " & return & OLD_IP giving up after 2
on idle
try
set IP_Changed to false
set Current_IP to ""
---get the current external IP address
do shell script "curl -s checkip.dyndns.org"
set Pub_IP to result
set Current_IP to Pub_IP as string
if Current_IP is equal to OLD_IP then
set IP_Changed to false ---if it is the same then it hasn't changed (false)
else
set IP_Changed to true ---if it is different then it has changed (true)
end if
if IP_Changed is true then ---if there is a difference the email the change to administrator(s)
set target_string to Current_IP as string
set replacement_string_1 to "<html><head><title>Current IP Check</title></head><body>"
set replacement_string_2 to "</body></html>"
my replace_and_select(target_string, replacement_string_1, replacement_string_2) ---removes HTML coding
tell application "Mail"
set Mail_to_1 to "admin@address.co.uk"
set Mail_from to "sender@address.co.uk"
set theName to "Administrator"
set theAddress to Mail_to_1
set theSubject to "Server Public IP Address"
set theBody to IP_text
set newMessage to make new outgoing message with properties {subject:theSubject, content:theBody & return & return}
tell newMessage
set visible to true
set sender to Mail_from
make new to recipient at end of to recipients with properties {name:theName, address:theAddress}
activate
send
end tell
end tell
set OLD_IP to Current_IP ---set Base IP to the new one ready for next test
end if
end try
return 3600 ---wait one hour before repeating the test
end idle
on replace_and_select(target_string, replacement_string_1, replacement_string_2)
set this_text to target_string as string
set this_offset to the offset of the replacement_string_1 in this_text
set this_offset_2 to the offset of the replacement_string_2 in this_text
set this_offset_3 to this_offset + (length of the replacement_string_1)
if this_offset is not 0 then
set IP_text to items this_offset_3 thru (this_offset_2 - 1) of target_string as string
end if
return
end replace_and_select