That is too late. You need to check $FORM{'ckusno'}BEFORE you open(MAIL ... and alter the value of $recipients then. You can still re-use the variable in the body of the email message, but you need to know who to send the message to before you start to send the message.