sendr/message/body

This module provides a lax representation of a message body as defined in RFC 5322, section 3.3.

It does not enforce any of the rules and requirements of the RFC. Since we do not know what transformations the Mail Submission Agent will perform and what the Mail Submission Agent is capable of handling.

Types

The body of the message.

A message can have two types of body content: (1) text: Plain text version of the message body (2) html: HTML version of the message body

pub type Body {
  Body(text: option.Option(String), html: option.Option(String))
}

Constructors

Values

pub const empty: Body

A new empty Body. This is the same as Body(None, None).

pub fn new(
  text text: option.Option(String),
  html html: option.Option(String),
) -> Body

Creates a new Body with a text and html body.

pub fn set_html(body body: Body, html html: String) -> Body

Set the html body

pub fn set_text(body body: Body, text text: String) -> Body

Set the textual body

Search Document