EmailMessage

For OUTGOING email

More...

Members

Functions

addAttachment
void addAttachment(string mimeType, string filename, void[] content, string id)

The filename is what is shown to the user, not the file on your sending computer. It should NOT have a path in it.

addInlineImage
void addInlineImage(string id, string mimeType, string filename, void[] content)

in the html, use img src="cid:ID_GIVEN_HERE"

addRecipient
void addRecipient(string name, string email, ToType how)
addRecipient
void addRecipient(string who, ToType how)
send
void send(RelayInfo mailServer)

Sends via a given SMTP relay

setHeader
void setHeader(string name, string value)
setHtmlBody
void setHtmlBody(string html)

automatically sets a text fallback if you haven't already

setTextBody
void setTextBody(string text)
toString
string toString()

Returns the MIME formatted email string, including encoded attachments

Variables

bcc
string[] bcc;
cc
string[] cc;
from
string from;
inReplyTo
string inReplyTo;
replyTo
string replyTo;
subject
string subject;
to
string[] to;

Detailed Description

To use:

auto message = new EmailMessage();
message.to ~= "someuser@example.com";
message.from = "youremail@example.com";
message.subject = "My Subject";
message.setTextBody("hi there");
//message.toString(); // get string to send externally
message.send(); // send via some relay
// may also set replyTo, etc

Meta