1. Trang chủ
  2. » Công Nghệ Thông Tin

PHP Developer''''s Dictionary- P42 potx

5 280 0
Tài liệu đã được kiểm tra trùng lặp

Đang tải... (xem toàn văn)

THÔNG TIN TÀI LIỆU

Thông tin cơ bản

Định dạng
Số trang 5
Dung lượng 438,22 KB

Các công cụ chuyển đổi và chỉnh sửa cho tài liệu này

Nội dung

string imap_bodyint imap_stream, int num, [int flags]; Description The imap_body function returns the body of the message specified by num from the mailbox connected to by imap_stream.

Trang 1

string imap_body(int imap_stream, int num, [int flags]);

Description

The imap_body() function returns the body of the message specified by num from the

mailbox connected to by imap_stream This function takes some optional flags ,

which is a bit mask of one or more of the items in Table 6.1

Table 6.1 Values for the flags Parameter

FT_INTERNAL Specifies the return string is in internal format This forces it not to

standardize to CRLF

FT_PEEK Tells the request not to set the \ Seen flag, assuming that it is not

already set

FT_UID Specifies that num is the UID and not the message ID

imap_check()

Syntax

object imap_check(int imap_stream);

Description

The imap_check() function returns an object with various properties that define the mailbox connected to by imap_stream These properties are as follows:

• Date—Contains the last change of the mailbox contents

• Driver—Returns the protocol used to access this mailbox, which could be POP3, IMAP, or NNTP

• Mailbox—Gives you the name of the mailbox

• Nmsgs—Returns the number of messages in the mailbox

• Recent—Returns the number of new messages in the mailbox

If the function fails, FALSE will be returned

imap_clearflag_full()

Syntax

Trang 2

string imap_clearflag_full (int imap_stream, string sequence, string flag,

string options);

Description

The imap_clearflag_full() function, which was added in PHP 3.0.3, clears the

flags on a message connected to by imap_stream The flags can be any of the

entries in the following list (You can check Request For Comments (RFC) 2060 at http://www.ietf.org/rfc/rfc2060.txt for more information on these flags.)

• \\Seen

• \\Answered

• \\Flagged

• \\Deleted

• \\Draft

• \\Recent

The options field contains a bit mask with one or more ST_UIDs, which are sequence arguments that contain UIDs instead of sequence numbers

imap_close()

Syntax

int imap_close(int imap_stream [, int flag])

Description

The imap_close() function closes the previously opened imap_stream This function

takes an optional CL_EXPUNGE flag that will cause the removal of all messages

marked for deletion

imap_createmailbox()

Syntax

int imap_createmailbox(int imap_stream, string mailbox)

Trang 3

Description

The imap_createmailbox() function creates a new mailbox, named mailbox , on

the system connected to by imap_stream The function returns 1 if successful, or 0

if unsuccessful

imap_delete()

Syntax

int imap_delete(int imap_stream, int message_num [, int flag])

Description

The imap_delete() function, which returns 1 if successful, marks the message located at message_num for deletion The optional flag is FT_UID and tells the function to treat message_num as a UID

After you have marked messages for deletion, you must either call the

imap_expunge() function, or pass CL_EXPUNGE to imap_close() when closing the connection, to delete the marked messages

Tip

If you are connecting to a POP3 mailbox, you need to expunge your marked messages before you close your connection Marked deletions are not carried across connections as in IMAP

imap_deletemailbox()

Syntax

int imap_deletemailbox(int imap_stream, string mailbox)

Description

The imap_deletemailbox() function deletes the specified mailbox from the imap_stream If successful, 1 is returned; otherwise, a 0 is returned on error

Tip

Check out imap_open() for more information on the formatting of mailbox names

Trang 4

imap_errors()

Syntax

array imap_errors()

Description

The imap_errors() function, which was added in PHP 3.0.12, is an array of all the error messages that have been generated since the beginning of the page or the last time you called the function

imap_expunge()

Syntax

int imap_expunge(int imap_stream)

Description

The imap_expunge() function removes all messages marked for deletion in the mailbox connected to by imap_stream Messages can be marked using the

imap_delete(), imap_move_mail(), or imap_setflag_full() functions

imap_fetch_overview()

Syntax

array imap_fetch_overview(int imap_stream, string sequence [, int

flag])

Description

The imap_fetch_overview() function, which was added in PHP 3.0.4, grabs the message headers for a given sequence and returns an overview of their contents

The sequence is a list of message IDs unless flag is set to FT_UID, in which case it represents UIDs

The array returned is an array of objects with the properties specified in Table 6.5

Table 6.5 Object Properties

Trang 5

Property Description

subject The subject of the messages

date When the message was sent

message_id The message ID

references A reference to this message ID

size Size of the message in bytes

uid UID of the message in the mailbox

msgno Message sequence number in the mailbox

recent The message has been flagged as recent

flagged The message has been flagged

answered The message has been flagged as answered

deleted The message has been flagged for deletion

seen The message has been flagged as read

draft The message has been flagged as a draft

The following example shows how you can grab messages 1–3 and 7 using this function

$overview = imap_fetch_overview($mailbox,"1:3,7",0);

imap_fetchbody()

Syntax

string imap_fetchbody(int imap_stream, int num, string part_num

[, flags flags])

Description

The imap_fetchbody() function will fetch the part—defined by part_num —of the

message at num You can optionally pass one or more of the flags in Table 6.2 to complete this procedure

Table 6.2 Values for the flags Parameter

FT_INTERNAL Specifies the return string is in internal format This forces it not to

standardize to CRLF

FT_PEEK Tells the request not to set the \ Seen flag, assuming that it is not

already set

FT_UID Specifies that num is the UID and not the message ID

Note

Ngày đăng: 07/07/2014, 05:20