diff --git a/src/freedombone-notification b/src/freedombone-notification
index 3293bb5a74b36c81092453d859adde52e5844de1..f08f269ae97969a12385775857b491bbd1654873 100755
--- a/src/freedombone-notification
+++ b/src/freedombone-notification
@@ -33,6 +33,7 @@ SUBJECT=
 MESSAGE=
 COMPLETION_FILE=/root/${PROJECT_NAME}-completed.txt
 notification_script=/tmp/xsend
+local_domain=$HOSTNAME
 
 function kill_xsend_process {
     # Sometimes the process can get stuck, so ensure that
@@ -81,7 +82,7 @@ if [ ! "$ADMIN_USERNAME" ]; then
 fi
 
 if [ ! "$ADMIN_EMAIL_ADDRESS" ]; then
-    ADMIN_EMAIL_ADDRESS=${ADMIN_USERNAME}@${HOSTNAME}
+    ADMIN_EMAIL_ADDRESS=${ADMIN_USERNAME}@${local_domain}
 fi
 
 notification_image_filename=/tmp/notification.jpg
@@ -125,13 +126,13 @@ fi
 
 if [ -d /etc/prosody ]; then
     notification_user_password=$(openssl rand -base64 32 | tr -dc A-Za-z0-9 | head -c 30 ; echo -n '')
-    if prosodyctl register "notification" "$HOSTNAME" "$notification_user_password"; then
+    if prosodyctl register "notification" "$local_domain" "$notification_user_password"; then
         { echo '#!/usr/bin/python2';
           echo 'import sys,os,xmpp,time';
           echo 'tojid = sys.argv[1]';
           echo 'data = sys.stdin.readlines()';
           echo "msg = ' '.join(data)";
-          echo "username = 'notification@$HOSTNAME'";
+          echo "username = 'notification@$local_domain'";
           echo "password = sys.argv[2]";
           echo 'jid=xmpp.protocol.JID(username)';
           echo 'cl=xmpp.Client(jid.getDomain(),debug=[])';
@@ -159,7 +160,7 @@ if [ -d /etc/prosody ]; then
         #kill_xsend_process
 
     fi
-    prosodyctl deluser "notification@$HOSTNAME"
+    prosodyctl deluser "notification@$local_domain"
 fi
 
 if [ -f $notification_image_filename ]; then