public static function getOutboxEmail($id)
    {
        global $PPHP;
        $db = $PPHP['db'];

        $q = $db->query("SELECT *, datetime(modified, 'localtime') AS localmodified FROM emails");
        $q->where('id = ?', $id);
        $email = $db->selectSingleArray($q);
        if ($email !== false) {
            foreach (array('recipients', 'ccs', 'bccs') as $col) {
                $email[$col] = dejoin(';', $email[$col]);
            };
        };
        $email['files'] = json_decode($email['files'], true);
        return $email;
    }