The $SERVICEOUTPUT$ variable when passed via the command line to either printf or perl generates an error on the command line which prevents it from running the notification email.
The question is “how to properly escape this variable” so that it doesn’t generate an error on the command line.