I would assume that you get undefined from this part of your flash code
messageSent.onLoad = function() {
if (this.sent == "OK") {
gotoAndStop("confirmed");
} else {
gotoAndStop("failed");
failure_txt.text = this.reason;
}
};
because your PHP page is returning a big fat error page or a blank page (depending on how administrator handles PHP errors) and the url key: "sent" doesn't exist because it was never written to the buffer.
I'd also bet it's because you are missing a semi-colon in the following code:
$OK = mail($to, $subject, $message, $additionalHeaders);
if ($OK) {
echo 'sent=OK';
}
else {
echo 'sent=failed&reason='. urlencode('Theres seems to be a problem with the server. Please try later.')}
Try sticking a semicolon right after your echo in the else part of the if statement.