Email

class Email(source)

An immutable email message. Create one with emailBuilder.

Properties

Link copied to clipboard

Attachments, including inline ones referenced by cid: URLs from the HTML body.

Link copied to clipboard

Hidden recipients; they are only part of the envelope and never rendered into headers.

Link copied to clipboard

Visible carbon copy recipients.

Link copied to clipboard

The Date header; the time of rendering is used if null.

Link copied to clipboard

This email as .eml (RFC 5322) string.

Link copied to clipboard

The author of the message.

Link copied to clipboard

Additional headers, rendered in the given order.

Link copied to clipboard
val html: String?

The HTML body.

Link copied to clipboard

The Message-IDs this message replies to, without angle brackets.

Link copied to clipboard

The Message-ID without angle brackets, e.g. 1234@example.com.

Link copied to clipboard

All envelope recipients: to, cc and bcc without duplicates.

Link copied to clipboard

The Message-IDs of the thread, without angle brackets.

Link copied to clipboard

Addresses replies should be sent to.

Link copied to clipboard

The subject line.

Link copied to clipboard
val text: String?

The plain text body.

Link copied to clipboard

Visible primary recipients.

Functions

Link copied to clipboard
inline fun Email.copy(builder: EmailBuilder.() -> Unit = {}): Email

Copy this email, modify it with builder and build it with a new message id.

Link copied to clipboard
inline fun Email.forward(from: EmailAddress, builder: EmailBuilder.() -> Unit = {}): Email

Forward this email. The original is attached as message/rfc822.

Link copied to clipboard

Create a builder pre-filled with this email's content and a new messageId.

Link copied to clipboard
fun Email.render(date: Instant = Clock.System.now()): RenderedEmail

Render this email to a MIME message.

Link copied to clipboard
inline fun Email.reply(from: EmailAddress, toAll: Boolean = false, builder: EmailBuilder.() -> Unit = {}): Email

Reply to this email. The new email is addressed to the Email.replyTo addresses (or Email.from), keeps the thread headers and quotes the original body.

Link copied to clipboard
suspend fun Email.send(mailer: Mailer = MailerManager.defaultMailer): SendReceipt

Send this email.

Link copied to clipboard
open override fun toString(): String