private function getMailObject()
 {
     require_once dirname(__FILE__) . '/../PHPMailer/PHPMailerAutoload.php';
     require_once dirname(__FILE__) . '/../CONFIG.php';
     global $is_smtp, $mail_host, $mail_user, $mail_password, $is_pop3;
     $mail = new PHPMailer();
     if ($is_smtp) {
         $mail->isSMTP();
         $mail->SMTPAuth = true;
         $mail->Host = $mail_host;
         $mail->Username = $mail_user;
         $mail->Password = $mail_password;
         $mail->SMTPSecure = 'tls';
         $mail->Port = 587;
     }
     if ($is_pop3) {
         $mail->isPOP3();
     }
     # Need to expand this
     $mail->From = 'blackhole@' . $this->getShortUrl();
     $mail->FromName = $this->getDomain() . ' Mailer Bot';
     $mail->isHTML(true);
     return $mail;
 }
function inviteUser($get)
{
    # Is the invite target valid?
    $destination = deEscape($get["invitee"]);
    if (!preg_match('/^(?:[a-z0-9!#$%&\'*+\\/=?^_`{|}~-]+(?:\\.[a-z0-9!#$%&\'*+\\/=?^_`{|}~-]+)*|"(?:[\\x01-\\x08\\x0b\\x0c\\x0e-\\x1f\\x21\\x23-\\x5b\\x5d-\\x7f]|\\\\[\\x01-\\x09\\x0b\\x0c\\x0e-\\x7f])*")@(?:(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?|\\[(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?|[a-z0-9-]*[a-z0-9]:(?:[\\x01-\\x08\\x0b\\x0c\\x0e-\\x1f\\x21-\\x5a\\x53-\\x7f]|\\\\[\\x01-\\x09\\x0b\\x0c\\x0e-\\x7f])+)\\])$/im', $destination)) {
        return array("status" => false, "action" => "INVITE_USER", "error" => "INVALID_EMAIL", "target" => $destination);
    }
    # Go through the process
    $u = new UserFunctions($login_status["detail"]["dblink"], 'dblink');
    # Does the invite target exist as a user?
    $userExists = $u->isEntry($destination, $u->userColumn);
    if ($userExists !== false) {
        return array("status" => false, "error" => "ALREADY_REGISTERED", "target" => $destination, "action" => "INVITE_USER");
    }
    require_once dirname(__FILE__) . '/admin/PHPMailer/PHPMailerAutoload.php';
    require_once dirname(__FILE__) . '/admin/CONFIG.php';
    global $is_smtp, $mail_host, $mail_user, $mail_password, $is_pop3;
    $mail = new PHPMailer();
    if ($is_smtp) {
        $mail->isSMTP();
        $mail->SMTPAuth = true;
        $mail->Host = $mail_host;
        $mail->Username = $mail_user;
        $mail->Password = $mail_password;
        $mail->SMTPSecure = 'tls';
        $mail->Port = 587;
    }
    if ($is_pop3) {
        $mail->isPOP3();
    }
    # Need to expand this
    $mail->From = $u->getUsername();
    $mail->FromName = $u->getShortUrl() . ' on behalf of ' . $u->getName();
    $mail->isHTML(true);
    $mail->addAddress($destination);
    $mail->Subject = "[" . $u->getShortUrl() . "] Invitation to Collaborate";
    $body = "<h1>You've been invited to join a research project!</h1><p>You've been invited to join " . $u->getShortUrl() . " by " . $u->getName() . " (" . $u->getUsername() . ").</p><p>Visit <a href='https://amphibiandisease.org/admin-login.php?q=create'>https://amphibiandisease.org/admin-login.php?q=create</a> to create a new user and get going!</p>";
    $mail->Body = $body;
    $success = $mail->send();
    if ($success) {
        return array("status" => $success, "action" => "INVITE_USER", "invited" => $destination);
    } else {
        return array("status" => $success, "action" => "INVITE_USER", "invited" => $destination, "error" => "MAIL_SEND_FAIL", "error_detail" => $mail->ErrorInfo);
    }
}