gdDocumentation0.8.0

API reference

GD.mail.mime

Parse and format MIME media types, encoded words, quoted-printable bytes, and multipart bodies.

Methods

parse_media_type

parse_media_type(text: String) -> Dictionary, Err

Parse a MIME media type and its parameters.

Parameters

NameTypeDefaultDescription
textStringRequiredText 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, Err

Format a MIME media type after checking parameter syntax.

Parameters

NameTypeDefaultDescription
typeStringRequiredMedia type of the response body.
paramsDictionaryRequiredParameter 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, Err

Encode one unstructured header word.

Parameters

NameTypeDefaultDescription
textStringRequiredText to inspect, decode or transform; the input is not modified in place.
modeString"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, Err

Decode one encoded header word.

Parameters

NameTypeDefaultDescription
textStringRequiredText 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, Err

Decode an unstructured header containing adjacent encoded words.

Parameters

NameTypeDefaultDescription
textStringRequiredText 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, Err

Encode body bytes with quoted-printable transfer syntax.

Parameters

NameTypeDefaultDescription
dataPackedByteArrayRequiredInput 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, Err

Decode quoted-printable body bytes.

Parameters

NameTypeDefaultDescription
dataPackedByteArrayRequiredInput 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, Err

Read quoted-printable escapes from a stream only as the caller requests bytes.

Parameters

NameTypeDefaultDescription
sourceVariantRequiredByte 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, Err

Write quoted-printable bytes through an asynchronous sink.

Parameters

NameTypeDefaultDescription
sinkVariantRequiredByte 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, Err

Traverse MIME parts from a boundary-delimited byte sequence.

Parameters

NameTypeDefaultDescription
dataPackedByteArrayRequiredInput data in the representation shown by the parameter type.
boundaryStringRequiredMIME 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, Err

Build a multipart body with an optional caller-selected boundary.

Parameters

NameTypeDefaultDescription
boundaryString""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, Err

Traverse MIME parts without holding the complete source body.

Parameters

NameTypeDefaultDescription
sourceVariantRequiredByte source providing read_async(max_bytes).
boundaryStringRequiredMIME 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, Err

Write MIME parts directly to an asynchronous byte sink.

Parameters

NameTypeDefaultDescription
sinkVariantRequiredByte destination providing write_async(data).
boundaryString""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.