This is an example that gets IMAP servers from yellowpages (NIS).
you can simple put map:map_yp_alias in your $imap_server_address in config.php use your own function instead map_yp_alias to map your LDAP whatever way to find the users IMAP server.
Requires access to external ypmatch program FIXME: it can be implemented in php yp extension or pecl (since php 5.1.0)
string
map_yp_alias
(string $username)
OBSOLETE FUNCTION should be removed after mailbox_display,
printMessage function is adapted $addr_ar = array(), $group = '' and $host='' arguments are used in 1.4.0
void
parseAddress
(string $address, [integer $max = 0])
-
string
$address
-
integer
$max
sqimap_append (line
1188)
Saves a message to a given folder -- used for saving sent messages
string
sqimap_append
(stream $imap_stream, $sMailbox, mixed $length, string $sent_folder)
-
stream
$imap_stream
-
string
$sent_folder
-
$sMailbox
sqimap_append_checkresponse (line
1217)
Displays error messages, if there are errors in responses to commands issues by sqimap_append() and sqimap_append_done() functions.
bool
sqimap_append_checkresponse
(string $response, string $sMailbox, [ $sid = ''], [ $query = ''])
-
string
$response
-
string
$sMailbox
-
$sid
-
$query
sqimap_append_done (line
1201)
void
sqimap_append_done
(mixed $imap_stream, [ $sMailbox = ''], string $folder)
-
string
$folder: (since 1.3.2)
-
$sMailbox
sqimap_capability (line
955)
Retrieve the CAPABILITY string from the IMAP server.
If capability is set, returns only that specific capability, else returns array of all capabilities.
mixed
sqimap_capability
(stream $imap_stream, [string $capability = ''], [boolean $bUseCache = true])
-
stream
$imap_stream
-
string
$capability: (since 1.3.0)
-
boolean
$bUseCache: (since 1.5.1) Controls use of capability data stored in session
sqimap_create_stream (line
644)
Connects to the IMAP server and returns a resource identifier for use with
the other SquirrelMail IMAP functions. Does NOT login!
imap-stream
sqimap_create_stream
(mixed $server, mixed $port, [integer $tls = 0])
-
integer
$tls: whether to use plain text(0), TLS(1) or STARTTLS(2) when connecting. Argument was boolean before 1.5.1.
sqimap_encode_mailbox_name (line
1050)
This encodes a mailbox name for use in IMAP commands.
string
sqimap_encode_mailbox_name
(string $what)
-
string
$what: the mailbox to encode
sqimap_error_box (line
344)
Function to display an error related to an IMAP query.
void
sqimap_error_box
(mixed $title, [mixed $query = ''], [mixed $message_title = ''], [mixed $message = ''], [string $link = ''])
-
string
$link: an optional link to try again
Custom fgets function: gets a line from the IMAP server, no matter how big it may be.
string
sqimap_fgets
(stream $imap_stream)
-
stream
$imap_stream: the stream to read from
string
sqimap_fread
(stream $imap_stream, integer $iSize, [boolean $filter = false], [mixed $outputstream = false], [boolean $no_return = false])
-
stream
$imap_stream
-
integer
$iSize
-
boolean
$filter
-
mixed
$outputstream: stream or 'php://stdout' string
-
boolean
$no_return: controls data returned by function
sqimap_get_delimiter (line
994)
Returns the delimiter between mailboxes: INBOX/Test, or INBOX.Test
string
sqimap_get_delimiter
([stream $imap_stream = false])
sqimap_get_num_messages (line
1065)
Gets the number of messages in the current mailbox.
OBSOLETE use sqimap_status_messages instead.
void
sqimap_get_num_messages
(stream $imap_stream, string $mailbox)
-
stream
$imap_stream: imap stream
-
string
$mailbox
sqimap_get_user_server (line
1292)
Allows mapping of IMAP server address with custom function
see map_yp_alias()
string
sqimap_get_user_server
(string $imap_server, string $username)
-
string
$imap_server: imap server address or mapping
-
string
$username
Logs the user into the IMAP server. If $hide is set, no error messages will be displayed. This function returns the IMAP connection handle.
stream
sqimap_login
(string $username, string $password, string $imap_server_address, integer $imap_port, boolean $hide)
-
string
$username: user name
-
string
$password: password encrypted with onetimepad. Since 1.5.2 function can use internal password functions, if parameter is set to boolean false.
-
string
$imap_server_address: address of imap server
-
integer
$imap_port: port of imap server
-
boolean
$hide: controls display connection errors
Simply logs out the IMAP session
void
sqimap_logout
(stream $imap_stream)
-
stream
$imap_stream: the IMAP connection to log out.
sqimap_prepare_pipelined_query (line
131)
void
sqimap_prepare_pipelined_query
(mixed $new_query, &$tag, &$aQuery, boolean $unique_id, string $tag, array $aQuery)
-
mixed
$new_query
-
string
$tag
-
array
$aQuery
-
boolean
$unique_id: see sqimap_session_id()
-
&$tag
-
&$aQuery
sqimap_read_data (line
622)
void
sqimap_read_data
(stream $imap_stream, string $tag_uid, boolean $handle_errors, &$response, &$message, [string $query = ''], [boolean $filter = false], [mixed $outputstream = false], [boolean $no_return = false], array $response, array $message)
-
stream
$imap_stream: imap string
-
string
$tag_uid
-
boolean
$handle_errors
-
array
$response
-
array
$message
-
string
$query: (since 1.2.5)
-
boolean
$filter: (since 1.4.1) see sqimap_fread()
-
mixed
$outputstream: (since 1.4.1) see sqimap_fread()
-
boolean
$no_return: (since 1.4.1) see sqimap_fread()
-
&$response
-
&$message
sqimap_read_data_list (line
315)
Obsolete function, inform plugins that use it
void
sqimap_read_data_list
(stream $imap_stream, string $tag, boolean $handle_errors, &$response, &$message, [string $query = ''], array $response, array $message)
-
stream
$imap_stream
-
string
$tag
-
boolean
$handle_errors
-
array
$response
-
array
$message
-
string
$query
-
&$response
-
&$message
sqimap_retrieve_imap_response (line
380)
Reads the output from the IMAP stream. If handle_errors is set to true, this will also handle all errors that are received. If it is not set, the errors will be sent back through $response and $message.
void
sqimap_retrieve_imap_response
(stream $imap_stream, string $tag, boolean $handle_errors, &$response, &$message, [string $query = ''], [boolean $filter = false], [mixed $outputstream = false], [boolean $no_return = false], array $response, array $message)
-
stream
$imap_stream: imap stream
-
string
$tag
-
boolean
$handle_errors: handle errors internally or send them in $response and $message.
-
array
$response
-
array
$message
-
string
$query: command that can be printed if something fails
-
boolean
$filter: see sqimap_fread()
-
mixed
$outputstream: see sqimap_fread()
-
boolean
$no_return: see sqimap_fread()
-
&$response
-
&$message
sqimap_run_command (line
88)
mixed
sqimap_run_command
(stream $imap_stream, string $query, boolean $handle_errors, &$response, &$message, [boolean $unique_id = false], [boolean $filter = false], [mixed $outputstream = false], [boolean $no_return = false], array $response, array $message)
-
stream
$imap_stream: imap connection resource
-
string
$query: imap command
-
boolean
$handle_errors: see sqimap_retrieve_imap_response()
-
array
$response: empty string, if return = false
-
array
$message: empty string, if return = false
-
boolean
$unique_id: (since 1.3.0) see sqimap_session_id()
-
boolean
$filter: (since 1.4.1 and 1.5.0) see sqimap_fread()
-
mixed
$outputstream: (since 1.4.1 and 1.5.0) see sqimap_fread()
-
boolean
$no_return: (since 1.4.1 and 1.5.0) see sqimap_fread()
-
&$response
-
&$message
sqimap_run_command_list (line
52)
Both send a command and accept the result from the command.
This is to allow proper session number handling.
mixed
sqimap_run_command_list
(stream $imap_stream, string $query, boolean $handle_errors, &$response, &$message, [boolean $unique_id = false], array $response, array $message)
-
stream
$imap_stream: imap connection resource
-
string
$query: imap command
-
boolean
$handle_errors: see sqimap_retrieve_imap_response()
-
array
$response
-
array
$message
-
boolean
$unique_id: (since 1.3.0) see sqimap_session_id().
-
&$response
-
&$message
sqimap_run_pipelined_command (line
151)
void
sqimap_run_pipelined_command
(stream $imap_stream, array $aQueryList, boolean $handle_errors, &$aServerResponse, &$aServerMessage, [boolean $unique_id = false], [boolean $filter = false], [mixed $outputstream = false], [boolean $no_return = false], array $aServerResponse, array $aServerMessage)
-
stream
$imap_stream: imap stream
-
array
$aQueryList
-
boolean
$handle_errors
-
array
$aServerResponse
-
array
$aServerMessage
-
boolean
$unique_id: see sqimap_session_id()
-
boolean
$filter: see sqimap_fread()
-
mixed
$outputstream: see sqimap_fread()
-
boolean
$no_return: see sqimap_fread()
-
&$aServerResponse
-
&$aServerMessage
sqimap_session_id (line
29)
Generates a new session ID by incrementing the last one used; this ensures that each command has a unique ID.
string
sqimap_session_id
([bool $unique_id = FALSE])
-
bool
$unique_id: (since 1.3.0) controls use of unique identifiers/message sequence numbers in IMAP commands. See IMAP rfc 'UID command' chapter.
sqimap_status_messages (line
1135)
Returns the status items of a mailbox.
Default it returns MESSAGES,UNSEEN and RECENT Supported status items are MESSAGES, UNSEEN, RECENT (since 1.4.0), UIDNEXT (since 1.5.1) and UIDVALIDITY (since 1.5.1)
array
sqimap_status_messages
(stream $imap_stream, string $mailbox, [array $aStatusItems = array('MESSAGES','UNSEEN','RECENT')])
-
stream
$imap_stream: imap stream
-
string
$mailbox: mail folder
-
array
$aStatusItems: status items
sqimap_unseen_messages (line
1119)
Returns the number of unseen messages in this folder.
obsoleted by sqimap_status_messages ! Arguments differ in 1.0.x
integer
sqimap_unseen_messages
(stream $imap_stream, string $mailbox)
-
stream
$imap_stream
-
string
$mailbox
_adaptAddress (line
1101)
OBSOLETE FUNCTION should be removed after mailbox_display, printMessage function is adapted
callback function used for formating of addresses array in parseAddress() function
void
_adaptAddress
( &$aAddr, integer $k, array $aAddr)
-
array
$aAddr
-
integer
$k: array key
-
&$aAddr