arsd.email

Create MIME emails with things like HTML, attachments, and send with convenience wrappers around std.net.curl's SMTP function, or read email from an mbox file.

For preparing and sending outgoing email, see EmailMessage. For processing incoming email or opening .eml files, mbox files, etc., see IncomingEmailMessage.

Members

Aliases

base64decode
alias base64decode = Base64.decoder

Base64 range decoder UFCS helper.

base64encode
alias base64encode = Base64.encoder

Base64 range encoder UFCS helper.

Classes

EmailMessage
class EmailMessage

For OUTGOING email

IncomingEmailMessage
class IncomingEmailMessage

Represents a single email from an incoming or saved source consisting of the raw data. Such saved sources include mbox files (which are several concatenated together, see MboxMessages for a full reader of these files), .eml files, and Maildir entries.

MimePart
class MimePart

for reading

Enums

ToType
enum ToType

Functions

decodeBase64Mime
immutable(ubyte[]) decodeBase64Mime(string encodedPart)

Base64 decoder, ignoring linebreaks which are mandated by RFC2045

email
void email(string to, string subject, string message, string from, RelayInfo mailServer)
encodeBase64Mime
string encodeBase64Mime(const(ubyte[]) content, string LINESEP)

Base64 encoded data with line length of 76 as mandated by RFC 2045 Section 6.8

processMboxData
MboxMessages processMboxData(immutable(ubyte)[] data)
with_header
auto with_header(MimeContainer container, string header)

Add header UFCS helper

Structs

EmailRecipient
struct EmailRecipient

Structured representation of email users, including the name and email address as separate components.

HeadersHash
struct HeadersHash

A type that acts similarly to a string[string] to hold email headers in a case-insensitive way.

MboxMessages
struct MboxMessages

An mbox file is a concatenated list of individual email messages. This is a range of messages given the content of one of those files.

MimeAttachment
struct MimeAttachment

Representation of an email attachment.

RecipientList
struct RecipientList

Structured representation of email users, including the name and email address as separate components.

RelayInfo
struct RelayInfo

Credentials for a SMTP relay, as passed to std.net.curl.SMTP.

Meta

History

Originally released as open source on August 11, 2012. The last-modified date of its predecessor file was January 2011.

Many of the public string members were overhauled on May 13, 2024. Compatibility methods are provided so your code will hopefully still work, but this also results in some stricter adherence to email encoding rules, so you should retest if you update after then.

Future Directions

I might merge IncomingEmailMessage and EmailMessage some day, it seems silly to have them completely separate like this.