Send email notifications on IP address change

I recently discovered that my home IP address is not as static as I would like. This will prove a problem if it changes while I'm away from home, so I needed to find a way to get updates on the IP if and when it changes. I threw together a quick bash script that I could run regularly with my server's cron daemon. Any time the IP address changes, it emails the provided email with a customizable message that includes both the old and new IP's.

#/bin/bash

#Variables
IPADDR=""
OLDIP=""
#Path to where you want the ip address file stored
HOME_PATH="/home/user"
IP_PATH="${HOME_PATH}/.ipaddress"
#Destination email address
EMAIL_DEST="user@example.com"
#Email body. Don't remove the inner double quotes, and remember to properly escape any single quotes
EMAIL_MSG=$'"This server'\''s IP address appears to have changed from $OLDIP to $IPADDR. Might be time to update your DNS!"'
#Email Subject
EMAIL_SUB="Server Alert: IP Address Change"

#Function: sends the email when called. Requires that you actually have mail configured to use a mail client.
email_alert ()
{
echo "$IPADDR" > "$IP_PATH"
eval EMAIL_MSG=$EMAIL_MSG
echo "$EMAIL_MSG" | mail -s "$EMAIL_SUB" "$EMAIL_DEST"
}

cd "$HOME_PATH"

#Grab our current IP address and do a quick sanity check
IPADDR=$(curl icanhazip.com -s | grep -m 1 -o --regexp="[0-9]\{1,\}\.[0-9]\{1,\}\.[0-9]\{1,\}\.[0-9]\{1,\}")

#Compare current IP to old IP and take appropriate actions
if (( ${#IPADDR} > 7 ))
then
if [ -e "$IP_PATH" ]
then
OLDIP=$(<"$IP_PATH")
if [ "$IPADDR" != "$OLDIP" ]
then
email_alert
fi
else
email_alert
fi
fi