PHP Developer’s Dictionary
IT-SC book
215
•
adl
• mailbox
• host
reply_toaddress
Returns full reply_to: line, up to 1,024 characters
reply_to[]
Returns an array of objects from the Reply_to line, containing
• personal
•
adl
• mailbox
•
host
senderaddress
Returns full sender: line, up to 1,024 characters
sender[]
Returns an array of objects from the sender line, containing
•
personal
• adl
•
mailbox
•
host
return_path
Returns full return-path: line, up to 1,024 characters.
return_path[]
Returns an array of objects from the return_path line, containing
•
personal
•
adl
•
mailbox
•
host
udate
Returns mail message date in UNIX time
fetchfrom
Returns from line formatted to fit
fromlength
characters
fetchsubject
Returns subject line formatted to fit
subjectlength
characters
imap_headers()
Syntax
array imap_headers(int imap_stream)
Description
The
imap_headers()
function returns an array of strings with header information.
There will be one array element per mail message.
imap_last_error()
Syntax
PHP Developer’s Dictionary
IT-SC book
216
string imap_last_error()
Description
The imap_last_error() function, which was added in PHP 3.0.12, returns the last
IMAP error that occurred on the page. Calling this function does not clear the error,
so subsequent calls will return the same error.
imap_listmailbox()
Syntax
array imap_listmailbox(int imap_stream, string ref, string pattern)
Description
The
imap_listmailbox()
function returns an array that contains the names of the
mailboxes connected to by imap_stream
. The ref
parameter is the same server
name that you used when you opened the stream with the
imap_open()
function.
You define which mailboxes to obtain information about by passing a pattern
for the
function to look for.
For pattern , there you can use
*
or
%
to represent two different wildcards. When
used,
*
will return all mailboxes.
%
, on the other hand, will return only the top-level
mailboxes.
imap_listsubscribed()
Syntax
array imap_listsubscribed(int imap_stream, string ref, string pattern)
Description
The
imap_listsubscribed()
function returns an array that contains the names of all
subscribed mailboxes connected to by
imap_stream
. The
ref
parameter is the same
server name that you used when you opened the stream with the
imap_open()
function. You define which mailboxes to obtain information about by passing a
pattern
for the function to look for.
For pattern
, you can use
*
or
%
to represent two different wildcards. When used,
*
returns all mailboxes.
%
, on the other hand, returns only the top-level mailboxes.
imap_mail()
PHP Developer’s Dictionary
IT-SC book
217
Syntax
string imap_mail(string to, string subject, string message
[, string additional_headers [, string cc [, string bcc
[, string rpath]]]])
Description
The imap_mail() function, which was added in PHP 3.0.14, will send an email
message to the address specified in to with subject . You can also pass any
additional_headers
, which are any additional addresses you want to
cc
or
bcc
.
imap_mail_compose()
Syntax
string imap_mail_compose(array envelope, array body)
Description
The
imap_mail_compose()
function, which was added in PHP 3.0.5, creates a MIME
message based on the envelope
and body
passed. Within the envelope
, you assign
values to matching keys, such as
to
,
subject
, and
from
.
imap_mail_copy()
Syntax
int imap_mail_copy(int imap_stream, string message_list, string mailbox
[, int flags])
Description
The
imap_mail_copy()
function copies the specified message_list
to a particular
mailbox . The optional flags are a bit mask field of one or more of the items in
Table 6.10
.
Table 6.10. Possible Values of the Bit Mask Field
Value
Description
CP_MOVE
Deletes the messages from the current mailbox after the copying is
complete.
CP_UID
The sequence numbers in
message_list
contains UIDs.
PHP Developer’s Dictionary
IT-SC book
218
imap_mail_move()
Syntax
int imap_mail_move(int
imap_stream,
string
message_list,
string
mailbox
[, int flag])
Description
The imap_mail_move() function moves the specified
message_list
to a particular
mailbox
. The optional
flag
is a bit mask field that can contain
CP_UID,
which
specifies that the sequence numbers in
message_list
contain UIDs.
imap_mailboxmsginfo()
Syntax
object imap_mailboxmsginfo(int imap_stream)
Description
The
imap_mailboxmsginfo()
function, which was added in PHP 3.0.2, will return
information about the current mailbox connected to by imap_stream
. If an error
occurs,
FALSE
will be returned. The function, when successful, returns its information
in an object with the properties listed in Table 6.9
.
Table 6.9. Properties of the Returned Object
Property
Description
Date
Date the mailbox last changed.
Driver
Driver.
Mailbox
Name of the mailbox.
Nmsgs
Number of messages in the mailbox.
Recent
Number of recent messages in the mailbox.
Unread
Number of unread messages in the mailbox.
Deleted
Number of deleted messages in the mailbox.
Size
Total size of mailbox.
imap_msgno()
Syntax
int imap_msgno(int imap_stream, int uid)
PHP Developer’s Dictionary
IT-SC book
219
Description
The
imap_msgno()
function, which was added in PHP 3.0.3, returns a message
sequence number for the uid passed.
imap_num_msg()
Syntax
int imap_num_msg(int imap_stream)
Description
The
imap_num_msg()
function returns the number of messages in the current
mailbox.
imap_num_recent()
Syntax
int imap_num_recent(int imap_stream)
Description
The
imap_num_recent()
function returns the number of recent messages in the
current mailbox.
imap_open()
Syntax
int imap_open(string mailbox, string username, string password [, int
flags])
Description