If you call the function with the bitmask-parameter FT_PREFETCHTEXT the /Seen flag of the message will be set.
imap_fetchheader
(PHP 4, PHP 5)
imap_fetchheader — メッセージのヘッダを返す
説明
string imap_fetchheader ( resource $imap_stream, int $msg_number [, int $options] )指定したメッセージについて、フィルタリング されていない完全な » RFC2822 フォーマットのヘッダをテキスト文字列として取得します。
パラメータ
- imap_stream
imap_open() が返す IMAP ストリーム。
- msg_number
メッセージ番号。
- options
オプション options は次のようになります。
- FT_UID - 引数 msgno は UID です。
- FT_INTERNAL - 返される文字列は "internal" フォーマットです。CRLF は正規化しません。
- FT_PREFETCHTEXT - RFC822.TEXT を、 同時に事前に取得しておく必要があります。これは、メッセージテキスト 全体を取得したい場合(例:「ローカルファイルに保存する」操作)に IMAP 接続で余分な RTT を回避します。
返り値
指定したメッセージのヘッダをテキスト文字列で返します。
参考
| imap_fetch_overview() |
imap_fetchheader
Max Geiger
09-Mar-2007 08:59
09-Mar-2007 08:59
dj_doktor at upskirt dot cz
03-Apr-2005 11:17
03-Apr-2005 11:17
I spend lot of time find out how I can detect messages with
different priorities. When I read users notes I remember
function imap_fetchheader which show header of message
and additional headers too. Because I'm so lazy to work with
regular expressions I required my frend for writing code
- thanx Znouza.
And there is... :)
<?php
// connecting to imap mailserver
$connection = @imap_open("{localhost:143/imap}INBOX", "your_username", "your_password");
// get imap_fetch header and put single lines into array
$header = explode("\n", imap_fetchheader($connection, 1));
// browse array for additional headers
if (is_array($header) && count($header)) {
$head = array();
foreach($header as $line) {
// is line with additional header?
if (eregi("^X-", $line)) {
// separate name and value
eregi("^([^:]*): (.*)", $line, $arg);
$head[$arg[1]] = $arg[2];
}
}
}
// now are all contained additional headers in array $head
?>