$email = (isset($sendTo))? $sendTo : '[(emailsender)]'; ... $static_recipient = "$email"; ... $to = ($recipient_type=="static") ? $static_recipient : $_POST['to']; ... if (mail($to, $subject, $body, $headers)) { ...