简介
These functions are not limited to the IMAP
protocol,
despite their name. The underlying c-client library also supports
NNTP
, POP3
and local mailbox access
methods.
需求
This extension requires the c-client library to be installed.
Grab the latest version from ftp://ftp.cac.washington.edu/imap/
and compile it.
It’s important that you do not copy the IMAP source files directly into
the system include directory as there may be conflicts. Instead, create
a new directory inside the system include directory, such as
/usr/local/imap-2000b/
(location and name
depend on your setup and IMAP version), and inside this new
directory create additional directories named lib/
and include/
. From the c-client
directory from your IMAP source tree, copy all the *.h
files into include/
and all the
*.c
files into lib/
.
Additionally when you compiled IMAP, a file named
c-client.a
was created. Also put this in the
lib/
directory but rename it as
libc-client.a
.
注:
To build the c-client library with SSL or/and Kerberos support read
the docs supplied with the package.
注:
In Mandrake Linux, the IMAP library (libc-client.a
)
is compiled without Kerberos support. A separate version with SSL
(client-PHP4.a
) is installed. The library must
be recompiled in order to add Kerberos support.
安装
To get these functions to work, you have to compile PHP with
–with-imap[=DIR]
, where DIR is the
c-client install prefix. From our example above, you would use
–with-imap=/usr/local/imap-2000b
.
This location depends on where you created this directory according to the
description above. Windows users may include the
php_imap.dll
DLL in php.ini
.
IMAP is not supported on systems earlier that Windows 2000. This is because it
uses encryption functions in order to enable SSL connections to the mail
servers.
注:
Depending how the c-client was configured, you might also need to add
–with-imap-ssl=/path/to/openssl/
and/or –with-kerberos=/path/to/kerberos
into the PHP configure line.
警告
IMAP
扩展模块不能和 recode
扩展模块,YAZ
扩展模块以及 Cyrus
扩展模块同时使用。因为它们使用了相同的内部符号。
运行时配置
本扩展模块在 php.ini
中未定义任何设置指令。
资源类型
预定义常量
以下常量由本扩展模块定义,因此只有在本扩展模块被编译到
PHP 中,或者在运行时被动态加载后才有效。
NIL
(integer
)
OP_DEBUG
(integer
)
OP_READONLY
(integer
)
Open mailbox read-only
OP_ANONYMOUS
(integer
)
Don’t use or update a .newsrc
for news
(NNTP only)
OP_SHORTCACHE
(integer
)
OP_SILENT
(integer
)
OP_PROTOTYPE
(integer
)
OP_HALFOPEN
(integer
)
For IMAP and NNTP names, open a connection but don’t open a mailbox.
OP_EXPUNGE
(integer
)
OP_SECURE
(integer
)
CL_EXPUNGE
(integer
)
silently expunge the mailbox before closing when
calling imap_close()
FT_UID
(integer
)
The parameter is a UID
FT_PEEK
(integer
)
Do not set the \Seen flag if not already set
FT_NOT
(integer
)
FT_INTERNAL
(integer
)
The return string is in internal format, will not canonicalize to CRLF.
FT_PREFETCHTEXT
(integer
)
ST_UID
(integer
)
The sequence argument contains UIDs instead of sequence numbers
ST_SILENT
(integer
)
ST_SET
(integer
)
CP_UID
(integer
)
the sequence numbers contain UIDS
CP_MOVE
(integer
)
Delete the messages from the current mailbox after copying
with imap_mail_copy()
SE_UID
(integer
)
Return UIDs instead of sequence numbers
SE_FREE
(integer
)
SE_NOPREFETCH
(integer
)
Don’t prefetch searched messages
SO_FREE
(integer
)
SO_NOSERVER
(integer
)
SA_MESSAGES
(integer
)
SA_RECENT
(integer
)
SA_UNSEEN
(integer
)
SA_UIDNEXT
(integer
)
SA_UIDVALIDITY
(integer
)
SA_ALL
(integer
)
LATT_NOINFERIORS
(integer
)
This mailbox has no “children” (there are no
mailboxes below this one).
LATT_NOSELECT
(integer
)
This is only a container, not a mailbox – you
cannot open it.
LATT_MARKED
(integer
)
This mailbox is marked. Only used by UW-IMAPD.
LATT_UNMARKED
(integer
)
This mailbox is not marked. Only used by
UW-IMAPD.
SORTDATE
(integer
)
Sort criteria for imap_sort()
:
message Date
SORTARRIVAL
(integer
)
Sort criteria for imap_sort()
:
arrival date
SORTFROM
(integer
)
Sort criteria for imap_sort()
:
mailbox in first From address
SORTSUBJECT
(integer
)
Sort criteria for imap_sort()
:
message subject
SORTTO
(integer
)
Sort criteria for imap_sort()
:
mailbox in first To address
SORTCC
(integer
)
Sort criteria for imap_sort()
:
mailbox in first cc address
SORTSIZE
(integer
)
Sort criteria for imap_sort()
:
size of message in octets
TYPETEXT
(integer
)
TYPEMULTIPART
(integer
)
TYPEMESSAGE
(integer
)
TYPEAPPLICATION
(integer
)
TYPEAUDIO
(integer
)
TYPEIMAGE
(integer
)
TYPEVIDEO
(integer
)
TYPEOTHER
(integer
)
ENC7BIT
(integer
)
ENC8BIT
(integer
)
ENCBINARY
(integer
)
ENCBASE64
(integer
)
ENCQUOTEDPRINTABLE
(integer
)
ENCOTHER
(integer
)
参见
This document can’t go into detail on all the topics touched by
the provided functions. Further information is provided by the
documentation of the c-client library source
(docs/internal.txt
). and the following RFC
documents:
RFC2821
: Simple Mail
Transfer Protocol (SMTP).
RFC2822
: Standard for
ARPA internet text messages.
RFC2060
: Internet
Message Access Protocol (IMAP) Version 4rev1.
RFC1939
: Post
Office Protocol Version 3 (POP3).
RFC977
: Network News
Transfer Protocol (NNTP).
RFC2076
: Common
Internet Message Headers.
RFC2045
, RFC2046
, RFC2047
, RFC2048
& RFC2049
: Multipurpose
Internet Mail Extensions (MIME).
A detailed overview is also available in the books
Programming Internet Email
by David Wood and Managing
IMAP
by Dianna Mullet & Kevin Mullet.