API reference
GD.mail.mime
Parse and format MIME media types, encoded words, quoted-printable bytes, and multipart bodies.
Methods
parse_media_type(text: String) -> Dictionary, Errformat_media_type(type: String, params: Dictionary) -> String, Errencode_word(text: String, mode: String = "b") -> String, Errdecode_word(text: String) -> String, Errdecode_header(text: String) -> String, Errquoted_printable_encode(data: PackedByteArray) -> PackedByteArray, Errquoted_printable_decode(data: PackedByteArray) -> PackedByteArray, Errquoted_printable_reader(source: Variant) -> Variant, Errquoted_printable_writer(sink: Variant) -> Variant, Errmultipart_reader(data: PackedByteArray, boundary: String) -> Variant, Errmultipart_writer(boundary: String = "") -> Variant, Errmultipart_reader_stream(source: Variant, boundary: String) -> Variant, Errmultipart_writer_to(sink: Variant, boundary: String = "") -> Variant, Err
parse_media_type
parse_media_type(text: String) -> Dictionary, ErrParse a MIME media type and its parameters.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
text | String | Required | Text to inspect, decode or transform; the input is not modified in place. |
Return value
Dictionary, Err
Errors
The result carries a value and an Err. Check the error before using the value; a failure may retain partial progress. In a function returning value, Err, use ? to propagate failure to the caller. The ! operator terminates the program on failure; in serve it fails the current handler.
format_media_type
format_media_type(type: String, params: Dictionary) -> String, ErrFormat a MIME media type after checking parameter syntax.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
type | String | Required | Media type of the response body. |
params | Dictionary | Required | Parameter values to bind to a prepared SQL statement. |
Return value
String, Err
Errors
The result carries a value and an Err. Check the error before using the value; a failure may retain partial progress. In a function returning value, Err, use ? to propagate failure to the caller. The ! operator terminates the program on failure; in serve it fails the current handler.
encode_word
encode_word(text: String, mode: String = "b") -> String, ErrEncode one unstructured header word.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
text | String | Required | Text to inspect, decode or transform; the input is not modified in place. |
mode | String | "b" | File access mode: read, write, append or read_write. |
Return value
String, Err
Errors
The result carries a value and an Err. Check the error before using the value; a failure may retain partial progress. In a function returning value, Err, use ? to propagate failure to the caller. The ! operator terminates the program on failure; in serve it fails the current handler.
decode_word
decode_word(text: String) -> String, ErrDecode one encoded header word.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
text | String | Required | Text to inspect, decode or transform; the input is not modified in place. |
Return value
String, Err
Errors
The result carries a value and an Err. Check the error before using the value; a failure may retain partial progress. In a function returning value, Err, use ? to propagate failure to the caller. The ! operator terminates the program on failure; in serve it fails the current handler.
decode_header
decode_header(text: String) -> String, ErrDecode an unstructured header containing adjacent encoded words.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
text | String | Required | Text to inspect, decode or transform; the input is not modified in place. |
Return value
String, Err
Errors
The result carries a value and an Err. Check the error before using the value; a failure may retain partial progress. In a function returning value, Err, use ? to propagate failure to the caller. The ! operator terminates the program on failure; in serve it fails the current handler.
quoted_printable_encode
quoted_printable_encode(data: PackedByteArray) -> PackedByteArray, ErrEncode body bytes with quoted-printable transfer syntax.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
data | PackedByteArray | Required | Input data in the representation shown by the parameter type. |
Return value
PackedByteArray, Err
Errors
The result carries a value and an Err. Check the error before using the value; a failure may retain partial progress. In a function returning value, Err, use ? to propagate failure to the caller. The ! operator terminates the program on failure; in serve it fails the current handler.
quoted_printable_decode
quoted_printable_decode(data: PackedByteArray) -> PackedByteArray, ErrDecode quoted-printable body bytes.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
data | PackedByteArray | Required | Input data in the representation shown by the parameter type. |
Return value
PackedByteArray, Err
Errors
The result carries a value and an Err. Check the error before using the value; a failure may retain partial progress. In a function returning value, Err, use ? to propagate failure to the caller. The ! operator terminates the program on failure; in serve it fails the current handler.
quoted_printable_reader
quoted_printable_reader(source: Variant) -> Variant, ErrRead quoted-printable escapes from a stream only as the caller requests bytes.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
source | Variant | Required | Byte source providing read_async(max_bytes). |
Return value
Variant, Err
Errors
The result carries a value and an Err. Check the error before using the value; a failure may retain partial progress. In a function returning value, Err, use ? to propagate failure to the caller. The ! operator terminates the program on failure; in serve it fails the current handler.
quoted_printable_writer
quoted_printable_writer(sink: Variant) -> Variant, ErrWrite quoted-printable bytes through an asynchronous sink.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
sink | Variant | Required | Byte destination providing write_async(data). |
Return value
Variant, Err
Errors
The result carries a value and an Err. Check the error before using the value; a failure may retain partial progress. In a function returning value, Err, use ? to propagate failure to the caller. The ! operator terminates the program on failure; in serve it fails the current handler.
multipart_reader
multipart_reader(data: PackedByteArray, boundary: String) -> Variant, ErrTraverse MIME parts from a boundary-delimited byte sequence.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
data | PackedByteArray | Required | Input data in the representation shown by the parameter type. |
boundary | String | Required | MIME boundary text separating multipart body parts. |
Return value
Variant, Err
Errors
The result carries a value and an Err. Check the error before using the value; a failure may retain partial progress. In a function returning value, Err, use ? to propagate failure to the caller. The ! operator terminates the program on failure; in serve it fails the current handler.
multipart_writer
multipart_writer(boundary: String = "") -> Variant, ErrBuild a multipart body with an optional caller-selected boundary.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
boundary | String | "" | MIME boundary text separating multipart body parts. |
Return value
Variant, Err
Errors
The result carries a value and an Err. Check the error before using the value; a failure may retain partial progress. In a function returning value, Err, use ? to propagate failure to the caller. The ! operator terminates the program on failure; in serve it fails the current handler.
multipart_reader_stream
multipart_reader_stream(source: Variant, boundary: String) -> Variant, ErrTraverse MIME parts without holding the complete source body.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
source | Variant | Required | Byte source providing read_async(max_bytes). |
boundary | String | Required | MIME boundary text separating multipart body parts. |
Return value
Variant, Err
Errors
The result carries a value and an Err. Check the error before using the value; a failure may retain partial progress. In a function returning value, Err, use ? to propagate failure to the caller. The ! operator terminates the program on failure; in serve it fails the current handler.
multipart_writer_to
multipart_writer_to(sink: Variant, boundary: String = "") -> Variant, ErrWrite MIME parts directly to an asynchronous byte sink.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
sink | Variant | Required | Byte destination providing write_async(data). |
boundary | String | "" | MIME boundary text separating multipart body parts. |
Return value
Variant, Err
Errors
The result carries a value and an Err. Check the error before using the value; a failure may retain partial progress. In a function returning value, Err, use ? to propagate failure to the caller. The ! operator terminates the program on failure; in serve it fails the current handler.