IPWorks S/MIME 2020 PHP Edition

Questions / Feedback?

SIMAP Class

Properties   Methods   Events   Configuration Settings   Errors  

The SIMAP Class is used to communicate with IMAP servers using the IMAP (Internet Message Access) protocol.

Class Name

IPWorksSMIME_SIMAP

Procedural Interface

 ipworkssmime_simap_open();
 ipworkssmime_simap_close($res);
 ipworkssmime_simap_register_callback($res, $id, $function);
 ipworkssmime_simap_get_last_error($res);
 ipworkssmime_simap_get_last_error_code($res);
 ipworkssmime_simap_set($res, $id, $index, $value);
 ipworkssmime_simap_get($res, $id, $index);
 ipworkssmime_simap_do_addmessageflags($res, $flags);
 ipworkssmime_simap_do_appendtomailbox($res);
 ipworkssmime_simap_do_checkmailbox($res);
 ipworkssmime_simap_do_closemailbox($res);
 ipworkssmime_simap_do_config($res, $configurationstring);
 ipworkssmime_simap_do_connect($res);
 ipworkssmime_simap_do_copytomailbox($res);
 ipworkssmime_simap_do_createmailbox($res);
 ipworkssmime_simap_do_decrypt($res);
 ipworkssmime_simap_do_decryptandverifysignature($res);
 ipworkssmime_simap_do_deletefrommailbox($res);
 ipworkssmime_simap_do_deletemailbox($res);
 ipworkssmime_simap_do_deletemailboxacl($res, $user);
 ipworkssmime_simap_do_disconnect($res);
 ipworkssmime_simap_do_doevents($res);
 ipworkssmime_simap_do_examinemailbox($res);
 ipworkssmime_simap_do_expungemailbox($res);
 ipworkssmime_simap_do_fetchmessageheaders($res);
 ipworkssmime_simap_do_fetchmessageinfo($res);
 ipworkssmime_simap_do_fetchmessagepart($res, $partid);
 ipworkssmime_simap_do_fetchmessagepartheaders($res, $partid);
 ipworkssmime_simap_do_fetchmessagetext($res);
 ipworkssmime_simap_do_getmailboxacl($res);
 ipworkssmime_simap_do_interrupt($res);
 ipworkssmime_simap_do_listmailboxes($res);
 ipworkssmime_simap_do_listsubscribedmailboxes($res);
 ipworkssmime_simap_do_localizedate($res, $datetime);
 ipworkssmime_simap_do_movetomailbox($res);
 ipworkssmime_simap_do_noop($res);
 ipworkssmime_simap_do_renamemailbox($res, $newname);
 ipworkssmime_simap_do_reset($res);
 ipworkssmime_simap_do_resetmessageflags($res);
 ipworkssmime_simap_do_searchmailbox($res, $searchcriteria);
 ipworkssmime_simap_do_selectmailbox($res);
 ipworkssmime_simap_do_setmailboxacl($res, $user, $rights);
 ipworkssmime_simap_do_startidle($res);
 ipworkssmime_simap_do_stopidle($res);
 ipworkssmime_simap_do_subscribemailbox($res);
 ipworkssmime_simap_do_unsetmessageflags($res);
 ipworkssmime_simap_do_unsubscribemailbox($res);
 ipworkssmime_simap_do_verifysignature($res);

Remarks

The SIMAP Class is the S/MIME enabled equivalent of the IPWorks IMAP class. In addition to standard IMAP functions the SIMAP class can decrypt and/or verify message signatures. The methods and properties for decrypting, and verifying signatures are identical to those provided with the S/MIME Class. When attempting to verify a signed message or when decrypting a message call the Decrypt, VerifySignature, or DecryptAndVerifySignature methods and the resulting text will be replaced in Message.

The SIMAP Class implements a standard IMAP client as specified in RFC 1730 and RFC 2060.

The first step in using the class is specifying a MailServer, a User to connect as, and a Password to authenticate with. After that, one or more requests may be sent to the server via the class's methods. Results are retrieved through events and a number of key properties.

Normally, after connecting to the server a Mailbox is selected (or examined) using the ExamineMailbox method. After the Mailbox is selected, MessageCount and RecentMessageCount show the number of messages in the mailbox, and MailboxFlags show the flags pertaining to the mailbox.

A number of operations may be performed by the server in response to commands sent via the class's methods. The primary arguments for most commands are the Mailbox property and the MessageSet property. The MessageSet property denotes either a single message, or a range of messages. Other arguments are specified through other properties such as SortCriteria, MessageFlags, etc.

Responses are received through events such as MessageInfo, MailboxList, and also reflected to properties such as MessageText, MessageSubject, etc.

The MessagePart event describes the MIME structure of retrieved messages. One MessagePart event is fired for every message part, giving information about the particular part. Later on, message parts may be retrieved separately through the FetchMessagePart method. This speeds up processing by avoiding the need to retrieve full messages from the server.

The PITrail event traces the interaction between the client and the server. It includes all exchanges except for transfers of messages, message parts, and message headers.

Property List


The following is the full list of the properties of the class with short descriptions. Click on the links for further details.

AuthMechanismThe authentication mechanism to be used when connecting to the mail server.
AutoDecodePartsDetermines whether to automatically decode message parts.
CertEncodedThe certificate (PEM/base64 encoded).
CertStoreThe name of the certificate store for the client certificate.
CertStorePasswordIf the certificate store is of a type that requires a password, this property is used to specify that password in order to open the certificate store.
CertStoreTypeThe type of certificate store for this certificate.
CertSubjectThe subject of the certificate used for client authentication.
CommandCan be used to send additional commands directly to the server.
ConnectedShows whether the class is connected.
EndByteThe byte index of the position where the transfer should end.
FirewallAutoDetectThis property tells the class whether or not to automatically detect and use firewall system settings, if available.
FirewallTypeThis property determines the type of firewall to connect through.
FirewallHostThis property contains the name or IP address of firewall (optional).
FirewallPasswordThis property contains a password if authentication is to be used when connecting through the firewall.
FirewallPortThis property contains the TCP port for the firewall Host .
FirewallUserThis property contains a user name if authentication is to be used connecting through a firewall.
IdleThe current status of the class.
LastReplyThe last reply from the server.
LocalFileThe path to a local file for downloading the message body. If the file exists, it is overwritten (optional).
LocalHostThe name of the local host or user-assigned IP interface through which connections are initiated or accepted.
MailboxName of the mailbox selected on the server.
MailboxFlagsDefines flags in the selected mailbox.
MailboxListCountThe number of records in the MailboxList arrays.
MailboxListFlagsThe mailbox flags in a mailbox listing.
MailboxListNameThe mailbox name in a mailbox listing.
MailboxListSeparatorThe Separator property contains the character that separates the different parts in the mailbox path hierarchy.
MailPortThe port of the IMAP server (default is 143).
MailServerThe name or address of the mail server (IMAP server).
MessageProvides the raw message content.
MessageContentEncodingThe ContentEncoding of the selected message.
MessageContentTypeThe ContentType of the message.
MessageCountThe total number of messages on the Mailbox .
MessageDateThe time the message was created.
MessageDeliveryTimeThe time the message was delivered to the mail server.
MessageEncryptedWhether or not the current message is encrypted.
MessageFlagsContains the flags of the current message.
MessageFromThe address of the author of the message.
MessageHeaderCountThe number of records in the MessageHeader arrays.
MessageHeaderFieldThis property contains the name of the HTTP header (same case as it is delivered).
MessageHeaderValueThis property contains the header contents.
MessageHeadersStringString version of RFC822-encoded headers of the message.
MessageIdThe message identifier of the current message.
MessageInfoCountThe number of records in the MessageInfo arrays.
MessageInfoDateThe date of a message in a message info listing.
MessageInfoFlagsMessage flag in a message info listing.
MessageInfoFromThe sender of a message in a message info listing.
MessageInfoMessageIdThe unique identifier of a message in a message info listing.
MessageInfoSizeThe size of a message in a message info listing.
MessageInfoSubjectThe subject of a message in a message info listing.
MessageInReplyToThe unique message identifier of the message this one is in reply to.
MessageNetIdThe globally unique identifier of the message.
MessagePartCountThe number of records in the MessagePart arrays.
MessagePartContentDispositionThis property shows the value of the Content-Disposition header of the message part.
MessagePartContentEncodingThis property shows how the data is encoded.
MessagePartContentIdThis property shows the value of the Content-Id header of the message part.
MessagePartContentTypeThis property shows the type of data contained in the message part.
MessagePartFilenameThis property shows the filename corresponding to the part (if the part was included in the message as an attached file).
MessagePartIdThis property contains the identifier of a part listing which may be identified in other parts or messages.
MessagePartMultipartModeThis property shows how this part relates to the message's whole multipart structure ('mixed', 'alternative', etc.
MessagePartParametersThis property contains the additional parameters passed to the ContentType header such as the part charset etc.
MessagePartSizeThis property contains the size of a part in a message part listing.
MessageRecipientCountThe number of records in the MessageRecipient arrays.
MessageRecipientAddressThis property contains the email address of the recipient.
MessageRecipientNameThis property contains name of the recipient.
MessageRecipientOptionsThis property contains the recipient sending options (used only by SMTP).
MessageRecipientTypeThis property contains the recipient type: To, Cc, or BCc.
MessageReplyToEmail address(s) where replies to the message should be sent.
MessageSenderThe address of the sender of the message.
MessageSetThe set of messages to operate on.
MessageSignedWhether or not the current message is signed.
MessageSizeThe size of the selected message.
MessageSubjectThe subject of the message.
MessageTextThe body of the retrieved message.
OverwriteIndicates whether or not the class should overwrite files during transfer.
PasswordThe password used to authenticate to the MailServer .
PeekModeWhen set to True, the message Seen flag is not changed during reading.
RecentMessageCountNumber of new messages in the Mailbox .
SignerCertEncodedThe certificate (PEM/base64 encoded).
SignerCertIssuerThe issuer of the certificate.
SignerCertSerialNumberThe serial number of the certificate encoded as a string.
SignerCertStoreThe name of the certificate store for the client certificate.
SignerCertStorePasswordIf the certificate store is of a type that requires a password, this property is used to specify that password in order to open the certificate store.
SignerCertStoreTypeThe type of certificate store for this certificate.
SignerCertSubjectThe subject of the certificate used for client authentication.
SignerCertChainCountThe number of records in the SignerCertChain arrays.
SignerCertChainEncodedThe certificate (PEM/base64 encoded).
SigningAlgorithmTextual description of the signature hash algorithm.
SortCriteriaSorts criteria to use for message retrieval operations.
SSLAcceptServerCertEncodedThe certificate (PEM/base64 encoded).
SSLCertEncodedThe certificate (PEM/base64 encoded).
SSLCertStoreThe name of the certificate store for the client certificate.
SSLCertStorePasswordIf the certificate store is of a type that requires a password, this property is used to specify that password in order to open the certificate store.
SSLCertStoreTypeThe type of certificate store for this certificate.
SSLCertSubjectThe subject of the certificate used for client authentication.
SSLEnabledWhether TLS/SSL is enabled.
SSLServerCertEncodedThe certificate (PEM/base64 encoded).
SSLStartModeDetermines how the class starts the SSL negotiation.
StartByteThe byte index of the position where the transfer should start.
TimeoutA timeout for the class.
UIDModeIf true, permanent message identifiers are used instead of the default temporary identifiers.
UIDValidityThe UIDValidity parameter sent from the server in response to SelectMailbox command.
UserThe user name used to authenticate to the MailServer .

Method List


The following is the full list of the methods of the class with short descriptions. Click on the links for further details.

AddMessageFlagsAdds the specified flags to the messages specified by MessageSet .
AppendToMailboxAppends the message in MessageText to the mailbox specified by Mailbox .
CheckMailboxSends a 'CHECK' command to the server.
CloseMailboxRemoves all messages marked with 'Deleted' flag from the currently selected mailbox and unselect mailbox.
ConfigSets or retrieves a configuration setting.
ConnectConnects to an IMAP server.
CopyToMailboxCopies the messages specified by MessageSet to the mailbox specified by Mailbox .
CreateMailboxCreates a new mailbox specified by Mailbox .
DecryptDecrypts the current Message .
DecryptAndVerifySignatureDecrypts and verifies the signature of the current message.
DeleteFromMailboxMarks the messages specified by MessageSet as deleted.
DeleteMailboxDeletes a mailbox specified by Mailbox .
DeleteMailboxACLDeletes mailbox access control rights for a specific user.
DisconnectDisconnects from an IMAP server.
DoEventsProcesses events from the internal message queue.
ExamineMailboxSelects a Mailbox (Read-only mode).
ExpungeMailboxRemoves all messages marked with 'Deleted' flag from the currently selected mailbox.
FetchMessageHeadersRetrieves the message headers of messages specified by the MessageSet property.
FetchMessageInfoRetrieves information about messages specified by the MessageSet property.
FetchMessagePartRetrieves the message part specified by PartID.
FetchMessagePartHeadersRetrieves the headers of message part specified by PartID.
FetchMessageTextRetrieves the message text of messages specified by the MessageSet property.
GetMailboxACLRetrieves mailbox access control rights.
InterruptInterrupt the current method.
ListMailboxesLists all mailboxes matching all criteria in the Mailbox property.
ListSubscribedMailboxesLists all subscribed mailboxes matching all criteria in the Mailbox property.
LocalizeDateConverts a valid RFC 822 message date to local date and time.
MoveToMailboxMoves the messages specified by MessageSet to the mailbox specified by Mailbox .
NoopSends a 'NOOP' command to the server.
RenameMailboxChange the name of Mailbox to NewName .
ResetReset the class.
ResetMessageFlagsReplaces the flags of the messages specified by MessageSet with the flags specified by MessageFlags .
SearchMailboxSearch selected mailbox for specified text.
SelectMailboxSelect a Mailbox.
SetMailboxACLSets mailbox access control rights for a specific user.
StartIdleBegins idling.
StopIdleStops idling.
SubscribeMailboxSubscribes to the mailbox specified by Mailbox .
UnsetMessageFlagsRemoves the flags specified by MessageFlags from the messages specified by MessageSet .
UnsubscribeMailboxUnsubscribes from the mailbox specified by Mailbox .
VerifySignatureVerifies the signature of the current message.

Event List


The following is the full list of the events fired by the class with short descriptions. Click on the links for further details.

ConnectionStatusFired to indicate changes in connection state.
EndTransferFired when the message or the part data finishes transferring.
ErrorInformation about errors during data delivery.
HeaderFired every time a header line comes in.
IdleInfoFires whenever responses from the server are received while idling.
MailboxACLFires for each set of access control rights returned by the server.
MailboxListFired for each mailbox received through the ListMailboxes and ListSubscribedMailboxes methods.
MessageInfoFired with information for the message(s) retrieved by the server.
MessagePartFired for each message part when FetchMessageInfo is called.
PITrailTraces the commands sent to the mail server, and the respective replies.
SSLServerAuthenticationFired after the server presents its certificate to the client.
SSLStatusShows the progress of the secure connection.
StartTransferFired when the message or the part data starts transferring.
TransferFired while the message gets transferred from the MailServer .

Configuration Settings


The following is a list of configuration settings for the class with short descriptions. Click on the links for further details.

RefetchHeadersWhether or not to re-fetch the message headers when querying MessageEncrypted or MessageSigned.
AlwaysReturnUIDsInstructs the server to return UIDs even if not in UIDMode.
AppendToMailboxDateTimeSpecifies the date-time parameter used in the initial APPEND request.
AuthorizationIdentityThe value to use as the authorization identity when SASL authentication is used.
AutoDecodeSubjectInstructs the class to automatically decode message subjects.
AutoDecodeTextWhether to decode MessageText when AutoDecodeParts is True.
FetchAfterSearchDetermines if messages matching the SearchCriteria are fetched after calling SearchMailbox.
FetchTextAndHeadersSpecifies whether the message body and headers are fetched in a single request.
IncludeHeadersInstructs the class to include the headers in the LocalFile.
MaskSensitiveWhether sensitive properties should be masked when logging.
SendIDCommandInstructs class to send the ID command if the server advertises support for it.
UTF7MailboxNamesSpecifies whether or not to automatically encode and decode UTF-7 mailbox names.
ConnectionTimeoutSets a separate timeout value for establishing a connection.
FirewallAutoDetectTells the class whether or not to automatically detect and use firewall system settings, if available.
FirewallHostName or IP address of firewall (optional).
FirewallPasswordPassword to be used if authentication is to be used when connecting through the firewall.
FirewallPortThe TCP port for the FirewallHost;.
FirewallTypeDetermines the type of firewall to connect through.
FirewallUserA user name if authentication is to be used connecting through a firewall.
KeepAliveIntervalThe retry interval, in milliseconds, to be used when a TCP keep-alive packet is sent and no response is received.
KeepAliveTimeThe inactivity time in milliseconds before a TCP keep-alive packet is sent.
LingerWhen set to True, connections are terminated gracefully.
LingerTimeTime in seconds to have the connection linger.
LocalHostThe name of the local host through which connections are initiated or accepted.
LocalPortThe port in the local host where the class binds.
MaxLineLengthThe maximum amount of data to accumulate when no EOL is found.
MaxTransferRateThe transfer rate limit in bytes per second.
ProxyExceptionsListA semicolon separated list of hosts and IPs to bypass when using a proxy.
TCPKeepAliveDetermines whether or not the keep alive socket option is enabled.
TcpNoDelayWhether or not to delay when sending packets.
UseIPv6Whether to use IPv6.
LogSSLPacketsControls whether SSL packets are logged when using the internal security API.
OpenSSLCADirThe path to a directory containing CA certificates.
OpenSSLCAFileName of the file containing the list of CA's trusted by your application.
OpenSSLCipherListA string that controls the ciphers to be used by SSL.
OpenSSLPrngSeedDataThe data to seed the pseudo random number generator (PRNG).
ReuseSSLSessionDetermines if the SSL session is reused.
SSLCACertFilePathsThe paths to CA certificate files on Unix/Linux.
SSLCACertsA newline separated list of CA certificate to use during SSL client authentication.
SSLCheckCRLWhether to check the Certificate Revocation List for the server certificate.
SSLCipherStrengthThe minimum cipher strength used for bulk encryption.
SSLEnabledCipherSuitesThe cipher suite to be used in an SSL negotiation.
SSLEnabledProtocolsUsed to enable/disable the supported security protocols.
SSLEnableRenegotiationWhether the renegotiation_info SSL extension is supported.
SSLIncludeCertChainWhether the entire certificate chain is included in the SSLServerAuthentication event.
SSLNegotiatedCipherReturns the negotiated ciphersuite.
SSLNegotiatedCipherStrengthReturns the negotiated ciphersuite strength.
SSLNegotiatedCipherSuiteReturns the negotiated ciphersuite.
SSLNegotiatedKeyExchangeReturns the negotiated key exchange algorithm.
SSLNegotiatedKeyExchangeStrengthReturns the negotiated key exchange algorithm strength.
SSLNegotiatedProtocolReturns the negotiated protocol version.
SSLProviderThe name of the security provider to use.
SSLSecurityFlagsFlags that control certificate verification.
SSLServerCACertsA newline separated list of CA certificate to use during SSL server certificate validation.
TLS12SignatureAlgorithmsDefines the allowed TLS 1.2 signature algorithms when UseInternalSecurityAPI is True.
TLS12SupportedGroupsThe supported groups for ECC.
TLS13KeyShareGroupsThe groups for which to pregenerate key shares.
TLS13SignatureAlgorithmsThe allowed certificate signature algorithms.
TLS13SupportedGroupsThe supported groups for (EC)DHE key exchange.
AbsoluteTimeoutDetermines whether timeouts are inactivity timeouts or absolute timeouts.
FirewallDataUsed to send extra data to the firewall.
InBufferSizeThe size in bytes of the incoming queue of the socket.
OutBufferSizeThe size in bytes of the outgoing queue of the socket.
BuildInfoInformation about the product's build.
CodePageThe system code page used for Unicode to Multibyte translations.
LicenseInfoInformation about the current license.
ProcessIdleEventsWhether the class uses its internal event loop to process events when the main thread is idle.
SelectWaitMillisThe length of time in milliseconds the class will wait when DoEvents is called if there are no events to process.
UseInternalSecurityAPITells the class whether or not to use the system security libraries or an internal implementation.

Copyright (c) 2022 /n software inc. - All rights reserved.
IPWorks S/MIME 2020 PHP Edition - Version 20.0 [Build 8154]