The reason the above pop3 functions are not documented anywhere is that you are supposed to use the imap_* functions to deal with pop3 servers as well.
From the documentation for function imap_open():
-----
This function can also be used to open streams to POP3 and NNTP servers, but some functions and features are only available on IMAP servers.
-----
Not sure if this applies only to apt package users, but the pop3_* functions aren't included at all.
This is not clear from PHPs documentation unless you read the imap docs yourself, so its understandable if people miss it.
The PHP team really should take all the PHP functions, sit down and map them all out, and then rename them using one single naming convention. They could keep the old names as aliases for bc.
It really would help, but until & unless that happens, I will be more and mor drawn towards Python and its beautiful conventionally named classes and functions.
IMAP, POP3 and NNTP
- Introduction
- Installing/Configuring
- Predefined Constants
- IMAP Functions
- imap_8bit — Convert an 8bit string to a quoted-printable string
- imap_alerts — Returns all IMAP alert messages that have occurred
- imap_append — Append a string message to a specified mailbox
- imap_base64 — Decode BASE64 encoded text
- imap_binary — Convert an 8bit string to a base64 string
- imap_body — Read the message body
- imap_bodystruct — Read the structure of a specified body section of a specific message
- imap_check — Check current mailbox
- imap_clearflag_full — Clears flags on messages
- imap_close — Close an IMAP stream
- imap_createmailbox — Create a new mailbox
- imap_delete — Mark a message for deletion from current mailbox
- imap_deletemailbox — Delete a mailbox
- imap_errors — Returns all of the IMAP errors that have occured
- imap_expunge — Delete all messages marked for deletion
- imap_fetch_overview — Read an overview of the information in the headers of the given message
- imap_fetchbody — Fetch a particular section of the body of the message
- imap_fetchheader — Returns header for a message
- imap_fetchstructure — Read the structure of a particular message
- imap_gc — Clears IMAP cache
- imap_get_quota — Retrieve the quota level settings, and usage statics per mailbox
- imap_get_quotaroot — Retrieve the quota settings per user
- imap_getacl — Gets the ACL for a given mailbox
- imap_getmailboxes — Read the list of mailboxes, returning detailed information on each one
- imap_getsubscribed — List all the subscribed mailboxes
- imap_header — Alias of imap_headerinfo
- imap_headerinfo — Read the header of the message
- imap_headers — Returns headers for all messages in a mailbox
- imap_last_error — Gets the last IMAP error that occurred during this page request
- imap_list — Read the list of mailboxes
- imap_listmailbox — Alias of imap_list
- imap_listscan — Returns the list of mailboxes that matches the given text
- imap_listsubscribed — Alias of imap_lsub
- imap_lsub — List all the subscribed mailboxes
- imap_mail_compose — Create a MIME message based on given envelope and body sections
- imap_mail_copy — Copy specified messages to a mailbox
- imap_mail_move — Move specified messages to a mailbox
- imap_mail — Send an email message
- imap_mailboxmsginfo — Get information about the current mailbox
- imap_mime_header_decode — Decode MIME header elements
- imap_msgno — Gets the message sequence number for the given UID
- imap_num_msg — Gets the number of messages in the current mailbox
- imap_num_recent — Gets the number of recent messages in current mailbox
- imap_open — Open an IMAP stream to a mailbox
- imap_ping — Check if the IMAP stream is still active
- imap_qprint — Convert a quoted-printable string to an 8 bit string
- imap_renamemailbox — Rename an old mailbox to new mailbox
- imap_reopen — Reopen IMAP stream to new mailbox
- imap_rfc822_parse_adrlist — Parses an address string
- imap_rfc822_parse_headers — Parse mail headers from a string
- imap_rfc822_write_address — Returns a properly formatted email address given the mailbox, host, and personal info
- imap_savebody — Save a specific body section to a file
- imap_scanmailbox — Alias of imap_listscan
- imap_search — This function returns an array of messages matching the given search criteria
- imap_set_quota — Sets a quota for a given mailbox
- imap_setacl — Sets the ACL for a giving mailbox
- imap_setflag_full — Sets flags on messages
- imap_sort — Gets and sort messages
- imap_status — Returns status information on a mailbox
- imap_subscribe — Subscribe to a mailbox
- imap_thread — Returns a tree of threaded message
- imap_timeout — Set or fetch imap timeout
- imap_uid — This function returns the UID for the given message sequence number
- imap_undelete — Unmark the message which is marked deleted
- imap_unsubscribe — Unsubscribe from a mailbox
- imap_utf7_decode — Decodes a modified UTF-7 encoded string
- imap_utf7_encode — Converts ISO-8859-1 string to modified UTF-7 text
- imap_utf8 — Converts MIME-encoded text to UTF-8
IMAP
alec
10-Sep-2008 04:08
10-Sep-2008 04:08
dickey at ascent dot co dot cc
25-Jun-2008 09:21
25-Jun-2008 09:21
I noticed there are no documentations for the pop3 and smtp extensions...
anyway here is a list of pop3 commands and how I understand them:
I have tried those with * in the beginning:
pop3_undelete ($pop3_handle, $message_no)
->to issue RSET command. I don't know if the $message_no parameter should be there or not. I think RSET would reset all messages marked for deletion.
pop3_delete_message ($pop3_handle, $message_no)
-> I assume it is to mark a message for deletion.
pop3_get_message ($pop3_handle, $message_no)
-> I assume it is to issue a RETR command.
*pop3_get_message_size ($pop3_handle, $message_no)
-> returns the size of the message.
*pop3_get_message_header ($pop3_handle, $message_no)
-> returns the message's headers.
pop3_get_message_sizes ($pop3_handle)
-> Lists messages and their sizes.
pop3_get_message_ids ($pop3_handle, $message_no)
-> Lists messages and their unique ids
*pop3_get_account_size($pop3_handle)
-> Returns the size limit of the mail account?
*pop3_get_message_count($pop3_handle)
-> Returns the number of messages from inbox.
*pop3_close($pop3_handle)
-> Closes the pop3 connection.
*$pop3_handle = pop3_open($Server,$username,$password)
-> Opens a connection to a pop3 server performs authentication and returns a handle to the pop3 connection.
Note: When you install your php you should include the pop3 extension.
Example:
$server = "tls://pop.gmail.com:995";
$username = "my_user_id@gmail.com";
$password = "mypassword";
$pop3 = pop3_open($server,$username,$password);
$message_header = pop3_get_message_header($pop3, 1);
print_r = $message_header;
pop3_close($pop3);
this code will print_r the message header of the first message. More work is needed to make the above code safe to execute.
