MimeBodyPart
class in package klyn.mails

    public class MimeBodyPart extends Object:

Object
└ MimeBodyPart

MIME body part.

The class can represent a text part, an HTML part or an attachment whose content is already available either as text or as Base64.

    import klyn.mails

    part = MimeBodyPart.text("Hello")
    print(part.contentType)

Fields

Modifier and Type | Member | Description
--- | --- | ---
public readonly | headers `headers as Map<String, String>` | Additional MIME headers for this part.

Properties

Modifier and Type | Member | Description
--- | --- | ---
public property | content `content as String` | Raw part content or already-encoded Base64 content.
public property | contentDisposition `contentDisposition as String` | Optional Content-Disposition header value.
public property | contentId `contentId as String` | Optional inline content identifier.
public property | contentType `contentType as String` | MIME content type.
public property | fileName `fileName as String` | Optional attachment or inline file name.
public property | transferEncoding `transferEncoding as String` | Content-Transfer-Encoding header value.

Properties inherited from Object: type
Constructors

Modifier and Type | Member | Description
--- | --- | ---
public | MimeBodyPart `MimeBodyPart(content as String = "", contentType as String = "text/plain; charset=UTF-8", transferEncoding as String = "base64"):` | Creates a MIME body part.

Methods

Modifier and Type | Member | Description
--- | --- | ---
public | asAttachment `asAttachment(fileName as String) as MimeBodyPart:` | Marks this part as an attachment.
public | asInline `asInline(contentId as String = "") as MimeBodyPart:` | Marks this part as inline content.
public static | attachmentBase64 `attachmentBase64(fileName as String, base64Content as String) as MimeBodyPart:` | Creates an attachment from Base64 content.
public static | attachmentBase64 `attachmentBase64(fileName as String, base64Content as String, contentType as String) as MimeBodyPart:` | Creates a Base64 attachment with an explicit content type.
public static | attachmentText `attachmentText(fileName as String, content as String) as MimeBodyPart:` | Creates a text attachment.
public static | attachmentText `attachmentText(fileName as String, content as String, contentType as String) as MimeBodyPart:` | Creates a text attachment with an explicit content type.
public | header `header(name as String, value as String) as MimeBodyPart:` | Adds or replaces a MIME header on this part.
public static | html `html(content as String, charset as String = "UTF-8") as MimeBodyPart:` | Creates an HTML body part.
public static | text `text(content as String, charset as String = "UTF-8") as MimeBodyPart:` | Creates a plain text body part.

Methods inherited from Object: fromJson, toDict, toJson, toString, toXml