Function EmailIntegration->_imap_get_part

Definitions

sources/mail_integration.php

  • Find a message part of an e-mail that matches a mime-type.Also collects a list of *all* attachments along the way, for APPLICATION/OCTET-STREAM.Taken from http://php.net/manual/en/function.imap-fetchbody.php.
  • Visibility: protected
  • Is abstract?: No
  • Is static?: No
  • Is final?: No
  • Returns: string

Parameters

Name Type Passed by reference? Variadic? Default Set Range Description
$stream resource No No required parameter N/A N/A IMAP connection object
$msg_number integer No No required parameter N/A N/A Message number
$needed_mime_type string No No required parameter N/A N/A Mime type we need (in upper case)
&$attachments array Yes No required parameter N/A N/A Map of attachments (name to file data); only populated if $needed_mime_type is appropriate for an attachment
&$attachment_size_total integer Yes No required parameter N/A N/A Total size of attachments in bytes
$input_charset string No No required parameter N/A N/A The character set of the e-mail
$structure ?object No No Null N/A N/A IMAP message structure (null: look up)
$part_number string No No Blank (empty string) N/A N/A Message part number (blank: root)

Returns

  • The message part (null: could not find one)
  • Type: ?string
  • Set: N/A
  • Range: N/A

Preview

Code (PHP)

/**
 * Find a message part of an e-mail that matches a mime-type.Also collects a list of *all* attachments along the way, for APPLICATION/OCTET-STREAM.Taken from http://php.net/manual/en/function.imap-fetchbody.php.
 *
 * @param  resource $stream IMAP connection object
 * @param  integer $msg_number Message number
 * @param  string $needed_mime_type Mime type we need (in upper case)
 * @param  array $attachments Map of attachments (name to file data); only populated if $needed_mime_type is appropriate for an attachment
 * @param  integer $attachment_size_total Total size of attachments in bytes
 * @param  string $input_charset The character set of the e-mail
 * @param  ?object $structure IMAP message structure (null: look up)
 * @param  string $part_number Message part number (blank: root)
 * @return ?string The message part (null: could not find one)
 */

protected function _imap_get_part($stream, int $msg_number, string $needed_mime_type, array &$attachments, int &$attachment_size_total, string $input_charset, ?object $structure = null, string $part_number = '') : ?string