$user->mailbox_imap_password = $mailboxconfig->mailbox_imap_password; $user->mailbox_imap_host = $mailboxconfig->mailbox_imap_host; $user->mailbox_imap_port = $mailboxconfig->mailbox_imap_port; $user->mailbox_imap_ssl = $mailboxconfig->mailbox_imap_ssl; $user->mailbox_imap_ssl_novalidate_cert = $mailboxconfig->mailbox_imap_ssl_novalidate_cert; $user->mailbox_imap_ref = $mailboxconfig->get_ref(); $user->mailbox_imap_connector_url = $mailboxconfig->get_connector_url(); if (GETPOST('reference_mail_uid') && GETPOST('reference_rowid') && GETPOST('reference_type_element')) { $mbox = imap_open($user->mailbox_imap_connector_url, $user->mailbox_imap_login, $user->mailbox_imap_password); if (FALSE === $mbox) { $info = FALSE; $err = 'La connexion a échoué. Vérifiez vos paramètres!'; } else { $uid = GETPOST('reference_mail_uid'); list($charset, $htmlmsg, $plainmsg, $attachments) = getmsg($mbox, $uid); $headerText = imap_fetchHeader($mbox, GETPOST('reference_mail_uid'), FT_UID); $header = imap_rfc822_parse_headers($headerText); switch ($charset) { case 'ISO-8859-1': case 'ISO-8859-15': $htmlmsg = utf8_encode($htmlmsg); $plainmsg = utf8_encode(nl2br($plainmsg)); break; default: $plainmsg = nl2br($plainmsg); } if ($htmlmsg != '') { $corps = $htmlmsg; } else { $corps = $plainmsg; }
<?php session_start(); $uid = $_GET['uid']; $gmail = 'gmail.com'; $yahoo = 'mail.yahoo.com'; $mbox = imap_open("{imap." . $_COOKIE['boxmail'] . ":993/imap/ssl}", $_COOKIE['email'], $_COOKIE['pass']); if (FALSE === $mbox) { die('echec !!!'); } else { $headerText = imap_fetchHeader($mbox, $uid, FT_UID); $header = imap_rfc822_parse_headers($headerText); // REM: Attention s'il y a plusieurs sections $corps = imap_fetchbody($mbox, $uid, 1, FT_UID); } imap_close($mbox); $from = $header->from; $msg = "Message de:" . $from[0]->personal . " [" . $from[0]->mailbox . "@" . $from[0]->host . "]<br>"; $msg .= $corps; include '../../vue/formulaire/Info.php';
} else { if (MAIL_SECURITY == 'TLS') { $imap_address .= '/tls'; } } $imap_address .= '}'; $mbox = imap_open($imap_address, MAIL_USERNAME, MAIL_PASSWORD); if ($mbox) { $num = imap_num_msg($mbox); if ($num > 0) { echo '<?xml version="1.0" encoding="UTF-8"?>' . "\n"; echo "\t" . '<rss version="2.0" xmlns:content="http://purl.org/rss/1.0/modules/content/">' . "\n"; echo '<channel><title>' . htmlspecialchars(MAIL_USERNAME) . '</title><link>http://' . $_SERVER["SERVER_NAME"] . $_SERVER["SCRIPT_NAME"] . '</link>'; echo '<description>Latest incoming mails in the mailbox</description><language>en-en</language><copyright></copyright>' . "\n\n"; for ($i = $num, $j = 0; $i >= 1 && $j < 20; $i--) { $headerText = imap_fetchHeader($mbox, $i); $header = imap_rfc822_parse_headers($headerText); $from = $header->from; $struct = imap_fetchstructure($mbox, $i); $is_plain_text = false; $content = ''; $charset = ''; $title = ''; if (!isset($struct->parts)) { $content = imap_fetchbody($mbox, $i, 1, FT_PEEK); $is_plain_text = true; foreach ($struct->parameters as $param) { if (strtolower($param->attribute) == "charset") { $charset = strtolower($param->value); } }