public class MimeBodyPart extends Object:
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)| Modifier and Type | Member | Description |
|---|---|---|
| public readonly | headers | Additional MIME headers for this part. |
| Modifier and Type | Member | Description |
|---|---|---|
| public property | contentcontent as String |
Raw part content or already-encoded Base64 content. |
| public property | contentDispositioncontentDisposition as String |
Optional Content-Disposition header value. |
| public property | contentIdcontentId as String |
Optional inline content identifier. |
| public property | contentTypecontentType as String |
MIME content type. |
| public property | fileNamefileName as String |
Optional attachment or inline file name. |
| public property | transferEncodingtransferEncoding as String |
Content-Transfer-Encoding header value. |
| Modifier and Type | Member | Description |
|---|---|---|
| public | MimeBodyPartMimeBodyPart(content as String = "",
contentType as String = "text/plain; charset=UTF-8",
transferEncoding as String = "base64"): |
Creates a MIME body part. |
| Modifier and Type | Member | Description |
|---|---|---|
| public | asAttachmentasAttachment(fileName as String) as MimeBodyPart: |
Marks this part as an attachment. |
| public | asInlineasInline(contentId as String = "") as MimeBodyPart: |
Marks this part as inline content. |
| public static | attachmentBase64attachmentBase64(fileName as String, base64Content as String) as MimeBodyPart: |
Creates an attachment from Base64 content. |
| public static | attachmentBase64attachmentBase64(fileName as String, base64Content as String, contentType as String) as MimeBodyPart: |
Creates a Base64 attachment with an explicit content type. |
| public static | attachmentTextattachmentText(fileName as String, content as String) as MimeBodyPart: |
Creates a text attachment. |
| public static | attachmentTextattachmentText(fileName as String, content as String, contentType as String) as MimeBodyPart: |
Creates a text attachment with an explicit content type. |
| public | headerheader(name as String, value as String) as MimeBodyPart: |
Adds or replaces a MIME header on this part. |
| public static | htmlhtml(content as String, charset as String = "UTF-8") as MimeBodyPart: |
Creates an HTML body part. |
| public static | texttext(content as String, charset as String = "UTF-8") as MimeBodyPart: |
Creates a plain text body part. |