Example #1
0
 * under the terms of the GNU Affero General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or (at
 * your option) any later version.
 * 
 * allocPSA is distributed in the hope that it will be useful, but WITHOUT
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public
 * License for more details.
 * 
 * You should have received a copy of the GNU Affero General Public License
 * along with allocPSA. If not, see <http://www.gnu.org/licenses/>.
*/
require_once "../alloc.php";
$info["host"] = config::get_config_item("allocEmailHost");
$info["port"] = config::get_config_item("allocEmailPort");
$info["username"] = config::get_config_item("allocEmailUsername");
$info["password"] = config::get_config_item("allocEmailPassword");
$info["protocol"] = config::get_config_item("allocEmailProtocol");
if (!$info["host"]) {
    alloc_error("Email mailbox host not defined, assuming email function is inactive.", true);
}
$email_receive = new email_receive($info);
$email_receive->open_mailbox(config::get_config_item("allocEmailFolder"), OP_HALFOPEN | OP_READONLY);
$email_receive->set_msg($_REQUEST["id"]);
$new_nums = $email_receive->get_new_email_msg_uids();
in_array($_REQUEST["id"], (array) $new_nums) and $new = true;
$mail_text = $email_receive->fetch_mail_text();
$new and $email_receive->set_unread();
// might have to "unread" the email, if it was new, i.e. set it back to new
$email_receive->close();
echo nl2br(trim(page::htmlentities($mail_text)));
Example #2
0
 function unread_email($req = array())
 {
     global $TPL;
     $info = inbox::get_mail_info();
     $email_receive = new email_receive($info);
     $email_receive->open_mailbox($info["folder"]);
     $email_receive->set_msg($req["id"]);
     $email_receive->set_unread();
     $email_receive->close();
 }