MimeMessage
classin packageklyn.mails
public class MimeMessage extends Message
└ Message
└ MimeMessage

MIME message inspired by JavaMail MimeMessage, adapted to Klyn.

Common authoring flows are exposed as direct properties and small helper methods instead of a large setter-based API.

import klyn.mails

message = MimeMessage()
message.from = InternetAddress("robot@example.com")
message.addTo("user@example.com")
message.subject = "Hello"
message.textBody = "Bonjour"
Inherited Attributes
attributeInherited Attributes from Message: bccRecipients, ccRecipients, headers, toRecipients
Properties
Modifier and Type Member Description
public property htmlBody
htmlBody as String
HTML body.
public property messageId
messageId as String
Optional explicit Message-ID.
public property multipart
multipart as MimeMultipart
Optional explicit MIME tree.
public property textBody
textBody as String
Plain text body.
Inherited Properties
propertyInherited Properties from Message: from, replyTo, sentDate, session, subject
propertyInherited Properties from Object: type
Constructors
Modifier and Type Member Description
public MimeMessage
MimeMessage(session as Session = null)
Creates a MIME message.
Methods
Modifier and Type Member Description
public attach
attach(part as MimeBodyPart) as MimeMessage
Adds an attachment.
public attachBase64
attachBase64(fileName as String, base64Content as String) as MimeMessage
Adds an attachment from Base64 content.
public attachBase64
attachBase64(fileName as String, base64Content as String, contentType as String) as MimeMessage
Adds a Base64 attachment with an explicit content type.
public attachText
attachText(fileName as String, content as String) as MimeMessage
Adds a text attachment.
public attachText
attachText(fileName as String, content as String, contentType as String) as MimeMessage
Adds a text attachment with an explicit content type.
public override header
header(name as String, value as String) as MimeMessage
Adds or replaces a custom message header.
public override render
render() as String throws MessagingException
Renders this message as RFC 5322 text.
Inherited Methods
methodInherited Methods from Message: addBcc, addBcc, addCc, addCc, addRecipient, addTo, addTo, allRecipients, header, render
methodInherited Methods from Object: deepCopy, fromJson, hash, toDict, toJson, toMap, toString, toXml