| Extracted from Pike v7.8 release 866 at 2018-07-18.

[Top]
MIME
MIME.Message

# Class MIME.Message

Description

  This class is used to hold a decoded MIME message.

Variable headers

  `mapping(string:string) MIME.Message.headers`

Description

  This mapping contains all the headers of the message.

  The key is the header name (in lower case) and the value is the header value.

  Although the mapping contains all headers, some particular headers get special treatment by the module and should not be accessed through this mapping. These fields are currently:

  `"content-type"`
  `"content-disposition"`
  `"content-length"`
  `"content-transfer-encoding"`

  The contents of these fields can be accessed and/or modified through a set of variables and methods available for this purpose.

See also

  type , subtype , charset , boundary , transfer_encoding , params , disposition , disp_params , setencoding() , setparam() , setdisp_param() , setcharset() , setboundary()

Variable body_parts

  `array(object) MIME.Message.body_parts`

Description

  If the message is of type `multipart`, this is an array containing one Message object for each part of the message. If the message is not a multipart, this field is `0` (zero).

See also

  type , boundary

Variable boundary

  `string MIME.Message.boundary`

Description

  For multipart messages, this `Content-Type` parameter gives a delimiter string for separating the individual messages. As multiparts are handled internally by the module, you should not need to access this field.

See also

  setboundary()

Variable charset

  `string MIME.Message.charset`

Description

  One of the possible parameters of the `Content-Type` header is the charset attribute. It determines the character encoding used in bodies of type `text`.

  If there is no `Content-Type` header, the value of this field is `"us-ascii"`.

See also

  type

Variable type

  `string MIME.Message.type`

Description

  The `Content-Type` header contains a type, a subtype, and optionally some parameters. This field contains the type attribute extracted from the header.

  If there is no `Content-Type` header, the value of this field is `"text"`.

See also

  subtype , params

Variable subtype

  `string MIME.Message.subtype`

Description

  The `Content-Type` header contains a type, a subtype, and optionally some parameters. This field contains the subtype attribute extracted from the header.

  If there is no `Content-Type` header, the value of this field is `"plain"`.

See also

  type , params

Variable transfer_encoding

  `string MIME.Message.transfer_encoding`

Description

  The contents of the `Content-Transfer-Encoding` header.

  If no `Content-Transfer-Encoding` header is given, this field is `0` (zero).

  Transfer encoding and decoding is done transparently by the module, so this field should be interesting only to applications wishing to do auto conversion of certain transfer encodings.

See also

  setencoding()

Variable params

  `mapping(string:string) MIME.Message.params`

Description

  A mapping containing all the additional parameters to the `Content-Type` header.

  Some of these parameters have fields of their own, which should be accessed instead of this mapping wherever applicable.

See also

  charset , boundary , setparam()

Variable disposition

  `string MIME.Message.disposition`

Description

  The first part of the `Content-Disposition` header, hinting on how this part of a multipart message should be presented in an interactive application.

  If there is no `Content-Disposition` header, this field is `0`.

Variable disp_params

  `mapping(string:string) MIME.Message.disp_params`

Description

  A mapping containing all the additional parameters to the `Content-Disposition` header.

See also

  setdisp_param() , get_filename()

Variable data

  `string MIME.Message.data`

Description

  This variable contains the raw data of the message body entity.

  The type and subtype attributes indicate how this data should be interpreted.

Note

  In Pike 7.6 and earlier you had to use getdata() and setdata() to access this value.

See also

  getdata() , setdata()