|
Wt
4.10.4
|
A mail message. More...
#include <Wt/Mail/Message.h>
Classes | |
| class | Header |
| An SMTP message header. More... | |
| class | Recipient |
| A struct representing a recipient. More... | |
Public Member Functions | |
| Message () | |
| Default constructor. | |
| void | setFrom (const Mailbox &from) |
| Sets the sender mailbox. | |
| const Mailbox & | from () const |
| Returns the sender mailbox. | |
| void | setReplyTo (const Mailbox &replyTo) |
| Sets the reply-to mailbox. | |
| const Mailbox & | replyTo () const |
| Returns the reply-to mailbox. | |
| void | setSubject (const WString &subject) |
| Sets a subject. | |
| const WString & | subject () const |
| Returns the subject. | |
| void | setDate (const WLocalDateTime &date) |
| Sets a date. | |
| WLocalDateTime | date () const |
| Returns the date. | |
| void | setBody (const WString &text) |
| Sets the plain text body. | |
| const WString & | body () const |
| Returns the plain text body. | |
| void | addRecipient (RecipientType type, const Mailbox &recipient) |
| Adds a recipient. | |
| const std::vector< Recipient > & | recipients () const |
| Returns the recipients. | |
| void | setHeader (const std::string &name, const std::string &value) |
| Sets a header value. | |
| void | addHeader (const std::string &name, const std::string &value) |
| Adds a header value. | |
| const std::vector< Header > & | headers () const |
| Returns the headers. | |
| const std::string * | getHeader (const std::string &name) const |
| Returns a header value. | |
| void | addHtmlBody (const WString &text) |
| Adds an HTML body. | |
| const WString & | htmlBody () const |
| Returns the HTML body. | |
| void | addAttachment (const std::string &mimeType, const std::string &fileName, std::istream *data) |
| Adds an attachment. | |
| void | write (std::ostream &out) const |
| Writes the message to the stream. | |
A mail message.
This class represents a MIME-compliant mail message.
The message can have a plain text body and an optional HTML body, which when present is encoded as an MIME multipart/alternative. It is recommended to send the same contents both in a plain text and an HTML variant.
Recipient names, names, and body text may contain unicode text.
| Wt::Mail::Message::Message | ( | ) |
Default constructor.
Creates an empty message. You need to add at least a sender and a recipient to create a valid email message.
| void Wt::Mail::Message::addAttachment | ( | const std::string & | mimeType, |
| const std::string & | fileName, | ||
| std::istream * | data ) |
Adds an attachment.
Ownership of the data stream is not transferred; you should keep this object valid until the message has been sent using Client::send() or written using write().
Adds a header value.
A header is added, even if a header with the same name already was present.
Adds an HTML body.
The text should be an HTML version of the plain text body.
| void Wt::Mail::Message::addRecipient | ( | RecipientType | type, |
| const Mailbox & | recipient ) |
Adds a recipient.
A mail can have multiple recipients.
Returns a header value.
Returns 0 if no header with that name is found.
Returns the recipients.
Returns the reply-to mailbox.
| void Wt::Mail::Message::setDate | ( | const WLocalDateTime & | date | ) |
Sets a date.
According to RFC 2822, the date should express local time.
Sets a header value.
If a header with that value was already defined, it is replaced with the new value. Otherwise, the header is added.
Returns the subject.
| void Wt::Mail::Message::write | ( | std::ostream & | out | ) | const |
Writes the message to the stream.
This writes the message as a MIME 1.0 message to the output stream.