ENCRYPT_SSL
ENCRYPT_SSL
Use the Secure Socket Layer to encrypt the session
Class ImapClient is helper class for imap access
$incomingMessage : \SSilence\ImapClient\IncomingMessage
Incoming message
connectDefault(string $mailbox, string $username, string $password, string $encryption = null) : void
The default connection.
Not used a lot of imap connection options. Use only ENCRYPT_SSL and VALIDATE_CERT.
If you need a more advanced connection settings, use connectAdvanced() method.
| string | $mailbox | |
| string | $username | |
| string | $password | |
| string | $encryption | use ImapClient::ENCRYPT_SSL or ImapClient::ENCRYPT_TLS |
saveEmail(string $file = null, integer $id = null, string $part = null) : boolean
Saves the email into a file Note: If your server does not have alot of RAM, this may break
| string | $file | |
| integer | $id | |
| string | $part |
true on success
saveEmailSafe(string $file = null, integer $id = null, string $part = null, string $streamFilter = 'convert.base64-decode') : boolean
Saves the email into a file Note: This is safer then saveEmail for slower servers
| string | $file | |
| integer | $id | |
| string | $part | |
| string | $streamFilter |
true on success
getFolders(string $separator = null, integer $type) : array
Returns all available folders
| string | $separator | default is '.' |
| integer | $type | has three meanings 0,1,2. If 0 return nested array, if 1 return an array of strings, if 2 return raw imap_list() |
with folder names
getMessagesByCriteria(string $criteria = '', integer $number, integer $start, string $order = 'DESC') : array
Get Messages by Criteria
| string | $criteria | ALL, UNSEEN, FLAGGED, UNANSWERED, DELETED, UNDELETED, etc (e.g. FROM "joey smith") |
| integer | $number | |
| integer | $start | |
| string | $order |
saveAttachmentsMessagesBySubject(string $subject, string $dir = null, string $charset = null) : void
Save Attachments Messages By Subject
| string | $subject | |
| string | $dir | for save attachments |
| string | $charset | for search |
getMessage(integer $id, string $decode = \SSilence\ImapClient\IncomingMessage::DECODE) : object
Returns one email by given id
Examples:
Structure
$imap = new ImapClient();
$imap->getMessage(5);
You can see all structure that
var_dump($imap->incomingMessage)
But use like this
$imap->incomingMessage->header->subject
$imap->incomingMessage->header->from
$imap->incomingMessage->header->to
# cc or bcc
$imap->incomingMessage->header->details->cc
$imap->incomingMessage->header->details->bcc
# and other ...
var_dump($imap->incomingMessage->header)
Next Text or Html body
$imap->incomingMessage->message->html
$imap->incomingMessage->message->plain
# below is array
$imap->incomingMessage->message->info
Array attachments
$imap->incomingMessage->attachment
Attachment have structure and body
$imap->incomingMessage->attachment[0]
$imap->incomingMessage->attachment[0]->structure
$imap->incomingMessage->attachment[0]->body
Count section
$imap->incomingMessage->section
And structure all message
$imap->incomingMessage->structure
$imap->getMessage(5);
$imap->saveAttachments();| integer | $id | |
| string | $decode | IncomingMessage::DECODE or IncomingMessage::NOT_DECODE |
IncomingMessage
saveAttachments(array $options = null) : void
Save attachments one incoming message
The allowed types are TypeAttachments You can add your own
| array | $options | have next parameters |
getAllEmailAddresses(array|null $options = null) : array
Returns all email addresses in all folders
If you have a lot of folders and letters, it can take a long time. And mark all the letters as read.
| array|null | $options | have options: |
with all email addresses or false on error
getEmailAddressesInFolder(string $folder, array|null $options = null) : array
Returns email addresses in the specified folder
| string | $folder | Specified folder |
| array|null | $options | have option |
addresses
imapFetchOverview(string $sequence, integer $options = null) : array
Wrapper for php imap_fetch_overview()
| string | $sequence | a message sequence description, you can enumerate desired messages with the X,Y syntax, or retrieve all messages within an interval with the X:Y syntax |
| integer | $options | sequence will contain a sequence of message indices or UIDs, if this parameter is set to FT_UID. |
toAddress(object $headerinfos) : string
Convert imap given address into string
| object | $headerinfos | the infos given by imap |
in format "Name email@bla.de"
arrayToAddress(array $addresses) : array
Converts imap given array of addresses as strings
| array | $addresses | imap given addresses as array |
with strings (e.g. ["Name email@bla.de", "Name2 email2@bla.de"]