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

PHP Developer''''s Dictionary- P45 docx

5 199 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 442,31 KB

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

Nội dung

The imap_qprint function will convert a quoted-printable string to an 8-bit string, which it returns.. imap_renamemailbox Syntax int imap_renamemailboxint imap_stream, string old_name,

Trang 1

The imap_open() function opens an IMAP stream to the specified mailbox To accomplish this connection, you must pass the appropriate username and password

If the attempt fails, an error will be returned

When using this function, the syntax for mailbox is important The first portion of

the mailbox value is the server name, path, and port number, which are contained

in brackets, "{ } " Following the brackets, you can specify a folder or group name depending on the type of server to which you are connecting

The optional flags parameter is a bit mask that can contain one or more of the

items in Table 6.11

Table 6.11 Values for the Bit Mask

CL_EXPUNGE Expunge mailbox automatically when closing connection

OP_ANONYMOUS Don't use or update an .newsrc for news (NNTP only)

OP_HALFOPEN Open a connection but not a mailbox (for IMAP and NNTP names) OP_READONLY Open mailbox in read-only mode

This function can be used to connect to an IMAP, POP3, or NNTP server Sample syntax for these connections are as follows:

$mbox = imap_open("{ imap.mcp.com:143} INBOX", "raw", "mypass"); //IMAP

$mbox = imap_open("{ pop3.mcp.com/pop3:110", "raw", "mypass"); //POP3

$mbox = imap_open("{ news.mcp.com/nntp:119} comp.lang", "raw",

"mypass"); //NNTP

imap_ping()

Syntax

int imap_ping(int imap_stream)

Description

The imap_ping() function will check whether imap_stream is still active and will

return 1 If not, 0 will be returned

imap_qprint()

Syntax

string imap_qprint(string string)

Description

Trang 2

The imap_qprint() function will convert a quoted-printable string to an 8-bit string, which it returns For more information on this conversion, you can check out Section 6.7

The imap_qprint() function will convert a quoted-printable string to an 8-bit string, which it returns For more information on this conversion, you can check out in the Request For Comments (RFC) 2045, which can be found at http://www.ietf.org/rfc/rfc2045.txt

imap_renamemailbox()

Syntax

int imap_renamemailbox(int imap_stream, string old_name, string

new_name)

Description

The imap_renamemailbox() function will rename the specified mailbox from

old_name to new_name Check the entry for imap_open() for how to format these names, which include the server name, port, and mailbox name

imap_reopen()

Syntax

int imap_reopen(int imap_stream, string mailbox [, string flags])

Description

The imap_reopen() function will reopen the imap_stream , but to a new mailbox

The optional flags parameter is a bit mask that can contain one or more of the

items in Table 6.12

Table 6.12 Values for the Bit Mask

CL_EXPUNGE Expunge mailbox automatically when closing connection

OP_ANONYMOUS Don't use or update an newsrc for news (NNTP only)

OP_HALFOPEN Open a connection but not a mailbox (for IMAP and NNTP names) OP_READONLY Open mailbox in read-only mode

imap_rfc822_parse_adrlist()

Syntax

Trang 3

array imap_rfc822_parse_adrlist(string address, string default_host)

Description

The imap_rfc822_parse_adrlist() function, which was added in PHP 3.0.2, parses the address on the default_host and returns an array of objects with the

properties in Table 6.13

Table 6.13 Properties of the Returned Object

mailbox The username of the mailbox

personal The personal name

adl At domain source route

The following is a quick example of how this works:

$address = "John Doe, mcp.com, jdoe";

$adrlist = imap_rfc822_parse_adrlist($address,"mcp.com");

reset($adrlist);

while(list($key,$value)=each($adrlist)){

print "mailbox: ".$value->mailbox."<br>\ n";

print "host: ".$value->host."<br>\ n";

print "personal: ".$value->personal."<br>\ n";

print "adl: ".$value->adl."<p>\ n";

}

imap_rfc822_parse_headers()

Syntax

object imap_rfc822_parse_headers(string headers [, string

default_host])

Description

The imap_rfc822_parse_headers() function, which was added in PHP 4.0, returns

an object with information on the headers You can use the optional default_host

parameter to specify the default host for the function to use

imap_rfc822_write_address()

Syntax

Trang 4

string imap_rfc822_write_address(string mailbox, string host, string personal)

Description

The imap_rfc822_write_address() function, which was added in PHP 3.0.2, returns

a properly formatted email address according to the Request For Comments (RFC)

822

// writes "John Doe <jdoe@mcp.com>

echo imap_rfc822_write_address('jdoe', 'mcp.com', 'John Doe')

imap_scanmailbox()

Syntax

array imap_scanmailbox (int imap_stream, string text)

Description

The imap_scanmailbox() function searches the mailbox connected to by

imap_stream for the occurrence of text in the mailbox All matching occurrences are stored in the returned array If you do not want to limit the returned data by specifying text, use the imap_listmailbox() function

imap_search()

Syntax

array imap_search(int imap_stream, string criteria, int flags)

Description

The imap_search() function, which was added in PHP 3.0.12, searches the mailbox connected to by imap_stream for the occurrence of criteria in the mailbox

criteria is a list of space-separated keywords and values If one of the values must contain a value, such as "John Doe", you must include that value in quotes The possible keywords that can be used are in Table 6.14

Table 6.14 Keywords That Can Be Used with imap_search()

Trang 5

ALL All messages matching the rest of the criteria

ANSWERED Match messages with the \ \ ANSWERED flag

BCC "string" Match messages with "string" in the Bcc field

BEFORE "date" Match messages with Date: before "date"

BODY "string" Match messages with "string" in the body of the message

CC "string" Match messages with "string" in the Cc field

DELETED Match deleted messages

FLAGGED Match messages with \ \ FLAGGED set

FROM "string" Match messages with "string" in the From field

KEYWORD "string" Match messages with "string" as a keyword

ON "date" Match messages with Date matching "date"

RECENT Match messages with \ \ RECENT set

SEEN Match messages with \ \ SEEN set

SINCE "date" Match messages with Date after "date"

SUBJECT "string" Match messages with "string" in the Subject field

TEXT "string" Match messages with text "string"

TO "string" Match messages with "string" in the To field

UNANSWERED Match messages that have not been answered

UNDELETED Match messages that are not deleted

UNFLAGGED Match messages that are not flagged

UNKEYWORD "string" Match messages that do not have the keyword "string" UNSEEN Match messages that have not been read yet

All matching occurrences from the criteria used are stored in the returned array

imap_setflag_full()

Syntax

string imap_setflag_full(int imap_stream, string sequence,

string message_flag [, string flag])

Description

The imap_setflag_full() function, which was added in PHP 3.0.3, sets the

message_flag on the messages specified by sequence The optional flag is a bit

mask that can be ST_UID, which specifies that sequence contains UIDs instead of

sequence numbers The sequence itself can be any of the following:

• \ \ Seen

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

TỪ KHÓA LIÊN QUAN