gcourier/message
This module provides tools for constructing RFC-compliant email messages.
Types
pub type Attachment {
Attachment(name: String, content_type: String, content: String)
}
Constructors
-
Attachment(name: String, content_type: String, content: String)
pub type Message {
Message(
headers: Dict(String, String),
to: List(String),
cc: List(String),
bcc: List(String),
content: String,
attachments: Option(List(Attachment)),
)
}
Constructors
-
Message( headers: Dict(String, String), to: List(String), cc: List(String), bcc: List(String), content: String, attachments: Option(List(Attachment)), )
pub type RecipientType {
To
CC
BCC
}
Constructors
-
To
-
CC
-
BCC
Values
pub fn add_attachment(
message: Message,
path: String,
name: String,
content_type: String,
) -> Message
pub fn add_recipient(
message: Message,
email: String,
recipient_type: RecipientType,
) -> Message
Add the provided address to the list of recipients.
recipient_type should be one of To, Cc, or Bcc.
pub fn set_date(message: Message, date: String) -> Message
Set the Date header for the email. Optional.
If this is not explicitly set, the current system time will be used automatically when the message is sent. This header indicates when the email was created.
pub fn set_from(
message: Message,
sender_address address: String,
sender_name name: Option(String),
) -> Message
Set the FROM header in the email.
pub fn set_sender(
message: Message,
sender_address address: String,
sender_name name: Option(String),
) -> Message
Set the optional sender header. Prefer FROM in most cases.
This field is useful when the email is sent on behalf of a third party or there are multiple emails in the FROM field.
pub fn set_subject(message: Message, subject: String) -> Message
Set the message’s subject line. Optional.