@@ -180,6 +180,154 @@ function imap_deletemailbox($imap_stream, string $mailbox): void
180180}
181181
182182
183+ /**
184+ * Fetches all the structured information for a given message.
185+ *
186+ * @param resource $imap_stream An IMAP stream returned by
187+ * imap_open.
188+ * @param int $msg_number The message number
189+ * @param int $options This optional parameter only has a single option,
190+ * FT_UID, which tells the function to treat the
191+ * msg_number argument as a
192+ * UID.
193+ * @return \stdClass Returns an object with properties listed in the table below.
194+ *
195+ *
196+ *
197+ * Returned Object for imap_fetchstructure
198+ *
199+ *
200+ *
201+ *
202+ * type
203+ * Primary body type
204+ *
205+ *
206+ * encoding
207+ * Body transfer encoding
208+ *
209+ *
210+ * ifsubtype
211+ * TRUE if there is a subtype string
212+ *
213+ *
214+ * subtype
215+ * MIME subtype
216+ *
217+ *
218+ * ifdescription
219+ * TRUE if there is a description string
220+ *
221+ *
222+ * description
223+ * Content description string
224+ *
225+ *
226+ * ifid
227+ * TRUE if there is an identification string
228+ *
229+ *
230+ * id
231+ * Identification string
232+ *
233+ *
234+ * lines
235+ * Number of lines
236+ *
237+ *
238+ * bytes
239+ * Number of bytes
240+ *
241+ *
242+ * ifdisposition
243+ * TRUE if there is a disposition string
244+ *
245+ *
246+ * disposition
247+ * Disposition string
248+ *
249+ *
250+ * ifdparameters
251+ * TRUE if the dparameters array exists
252+ *
253+ *
254+ * dparameters
255+ * An array of objects where each object has an
256+ * "attribute" and a "value"
257+ * property corresponding to the parameters on the
258+ * Content-disposition MIME
259+ * header.
260+ *
261+ *
262+ * ifparameters
263+ * TRUE if the parameters array exists
264+ *
265+ *
266+ * parameters
267+ * An array of objects where each object has an
268+ * "attribute" and a "value"
269+ * property.
270+ *
271+ *
272+ * parts
273+ * An array of objects identical in structure to the top-level
274+ * object, each of which corresponds to a MIME body
275+ * part.
276+ *
277+ *
278+ *
279+ *
280+ *
281+ *
282+ * Primary body type (value may vary with used library, use of constants is recommended)
283+ *
284+ *
285+ * ValueTypeConstant
286+ *
287+ *
288+ * 0textTYPETEXT
289+ * 1multipartTYPEMULTIPART
290+ * 2messageTYPEMESSAGE
291+ * 3applicationTYPEAPPLICATION
292+ * 4audioTYPEAUDIO
293+ * 5imageTYPEIMAGE
294+ * 6videoTYPEVIDEO
295+ * 7modelTYPEMODEL
296+ * 8otherTYPEOTHER
297+ *
298+ *
299+ *
300+ *
301+ *
302+ * Transfer encodings (value may vary with used library, use of constants is recommended)
303+ *
304+ *
305+ * ValueTypeConstant
306+ *
307+ *
308+ * 07bitENC7BIT
309+ * 18bitENC8BIT
310+ * 2BinaryENCBINARY
311+ * 3Base64ENCBASE64
312+ * 4Quoted-PrintableENCQUOTEDPRINTABLE
313+ * 5otherENCOTHER
314+ *
315+ *
316+ *
317+ * @throws ImapException
318+ *
319+ */
320+ function imap_fetchstructure ($ imap_stream , int $ msg_number , int $ options = 0 ): \stdClass
321+ {
322+ error_clear_last ();
323+ $ result = \imap_fetchstructure ($ imap_stream , $ msg_number , $ options );
324+ if ($ result === false ) {
325+ throw ImapException::createFromPhpError ();
326+ }
327+ return $ result ;
328+ }
329+
330+
183331/**
184332 * Purges the cache of entries of a specific type.
185333 *
0 commit comments