// close cURL resource, and free up system resources
    curl_close($ch);
    #$contents = file_get_contents('../vcard.vcf');
    // and save it to a temporary location (so that it gets a nice filename)
    $dir = '/tmp/' . md5(time());
    mkdir($dir);
    $tempFile = $dir . '/NeilCrosby.vcf';
    file_put_contents($tempFile, $contents);
    // send the email
    require 'geekMail-1.0.php';
    $geekMail = new geekMail();
    $geekMail->setMailType('text');
    $geekMail->from('*****@*****.**', 'Neil Crosby');
    $geekMail->to($email);
    $geekMail->subject("Neil Crosby's vCard");
    $geekMail->message("Thanks for downloading my vCard.\n\nIf you're using an iPhone, scroll down to the bottom of the attached card to add it to your address book.\n\nDon't forget you can always get an up to date copy from http://neilcrosby.com/vcard");
    $geekMail->attach($tempFile);
    if ($geekMail->send()) {
        unlink($tempFile);
        header("Location: http://neilcrosby.com/vcard/via-email/sent/");
    } else {
        $errors = $geekMail->getDebugger();
        print_r($errors);
    }
    unlink($tempFile);
    exit;
}
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
    "http://www.w3.org/TR/html4/strict.dtd">
<html lang="en">
            if ($newkey) {
                $arr["type:" . $newkey] = $value;
            } else {
                print '({"error":"Can\'t find the global concept ID for field type #"' . $typeid . '"})';
                exit;
            }
        } else {
            $arr[$key] = $value;
        }
    }
    //for
    $newrectype = getRecTypeConceptID($_POST["rectype"]);
    if ($newrectype) {
        $arr["rectype"] = $newrectype;
    } else {
        print '({"error":"Can\'t find the global concept ID for record type #"' . $_POST["rectype"] . '"})';
        exit;
    }
}
// converts _POST array into string
//$message = json_format($_POST);
$message = json_encode($arr);
$geekMail->message($message);
if (!$geekMail->send()) {
    //$errors = $geekMail->getDebugger();
    //print_r($errors);
    print '({"error":"Cannot send email. Please ask system administrator to verify that mailing is enabled on your server"})';
} else {
    print '({"result":"ok"})';
}
//print '({"result":"ok"})';