Name

Attachment Functions — This section describes functions which are performed on MAPI Attachment objects.

Synopsis

string mapi_attach_openbin(mapiattach $attach,
                           long $proptag);

mapimessage mapi_attach_openobj(mapiattach $attach,
                                long $flags);

Details

mapi_attach_openbin ()

string mapi_attach_openbin(mapiattach $attach, long $proptag

Read binary contents of attachment

Retrieves the actual attachment data in the attachment when the attachment has PR_ATTACH_METHOD is 1 (ATTACH_BY_VALUE). Returns a binary string on success, FALSE on failure.

$attach
The attachment of which to retrieve binary attachment data.

Example 3.55. Getting attachment data

// Open attachment number 0
$attach = mapi_message_openattach ($message, 0);

// Output attachment data
print(mapi_attach_openbin($attach, PR_ATTACH_DATA_BIN));
	  

mapi_attach_openobj ()

mapimessage mapi_attach_openobj(mapiattach $attach, long $flags

Read message contents of attachment

Returns a message object which is embedded in an attachment. This can be done for attachment which have PR_ATTACH_METHOD 5 (ATTACH_EMBEDDED_MSG). Returns a mapimessage object on success, FALSE on failure.

$attach
The attachment of which to retrieve message attachment data.
$flags (optional)

Bitmask of flags that controls access to the property. The following flags can be set:

MAPI_CREATE

If the property does not exist, it should be created. If the property does exist, the current value of the property should be discarded. When a caller sets the MAPI_CREATE flag, it should also set the MAPI_MODIFY flag.

MAPI_MODIFY

Requests read/write access to the property. The default access is read-only. MAPI_MODIFY must be set when MAPI_CREATE is set.

Example 3.56. Getting the attachment message

// Open attachment number 0
$attach = mapi_message_openattach($message, 0);

// Open embedded message
$message = mapi_attach_openobj($attach);

// Show message contents
print_r(mapi_message_getprops($message);