Passing paramater to email script

I’ve written a small script used to send email out of Nagios. I want to pass a parameter to this script that indicates if the email should be high or normal priority.

My contacts are all derived from this template.

define contact{
        name                            generic-contact
        service_notification_commands   notify-service-email
        host_notification_commands      notify-host-email
        }

The check command is

define command{
        command_name    notify-host-email
        command_line    /usr/bin/perl /usr/lib/nagios/plugins/send_email.pl \
                --smtp <My Host> --from "[email protected]" --email "$CONTACTEMAIL$" \
                --subject "$HOSTADDRESS$ $HOSTSTATE$" \
                --body "$HOSTADDRESS$: $HOSTSTATE$ \n$HOSTOUTPUT$\n$LONGHOSTOUTPUT$\n$NOTIFICATIONCOMMENT$" \
                <whatever I need for a priority to pass>
}

The script works but I don’t have any idea how to pass something from a specific service or host check all the way back to this point or if it even possible. Please help.

I found a working solution. On the hosts and services that I want the elevated logging for I added a custom macro _PRIORITY with a value of high.
I’m then passing the value of this variable as a parameter to my script. It’s not perfect - I would have preferred a defined / not defined check versus having to have the macro’s contents defined just right - but it works.