PHP: imap_fetchheader - Manual

downloads | documentation | faq | getting help | mailing lists | reporting bugs | php.net sites | links | conferences | my php.net

search for in the

imap_fetchstructure imap_fetchbody

Last updated: Fri, 26 Jan 2007

view this page in

# imap_fetchheader

(PHP 3 >= 3.0.3, PHP 4, PHP 5)

imap_fetchheader -- Returns header for a message

## Описание

string imap_fetchheader ( resource imap_stream, int msg_number [, int options] )

This function causes a fetch of the complete, unfiltered RFC2822 format header of the specified message.

## Список параметров

`imap_stream`

  An IMAP stream returned by imap_open().

`msg_number`

  The message number

`options`

  The possible `options` are:

  - `FT_UID` - The `msgno` argument is a UID

  - `FT_INTERNAL` - The return string is in "internal" format, without any attempt to canonicalize to CRLF newlines

  - `FT_PREFETCHTEXT` - The RFC822.TEXT should be pre-fetched at the same time. This avoids an extra RTT on an IMAP connection if a full message text is desired (e.g. in a "save to local file" operation)

## Возвращаемые значения

Returns the header of the specified message as a text string.

## Смотрите также

imap_fetch_overview()

add a note User Contributed Notes
imap_fetchheader
Max Geiger
08-Mar-2007 03:59
`If you call the function with the bitmask-parameter FT_PREFETCHTEXT the /Seen flag of the message will be set.`
dj_doktor at upskirt dot cz
03-Apr-2005 07: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
?>`
add a note
imap_fetchstructure imap_fetchbody

Last updated: Fri, 26 Jan 2007
show source | credits | stats | sitemap | contact | advertising | mirror sites
Copyright © 2001-2007 The PHP Group
All rights reserved.
This mirror generously provided by: Yahoo! Inc.
Last updated: Sat Mar 10 09:32:46 2007 PST