Logo Search packages:      
Sourcecode: poco version File versions  Download package

Poco::Net::MailMessage Class Reference

#include <MailMessage.h>

Inheritance diagram for Poco::Net::MailMessage:

Poco::Net::MessageHeader Poco::Net::NameValueCollection

List of all members.

Detailed Description

This class represents an e-mail message for use with the SMTPClientSession and POPClientSession classes.

MailMessage supports both old-style plain text messages, as well as MIME multipart mail messages with attachments.

For multi-part messages, the following content transfer encodings are supported: 7bit, 8bit, quoted-printable and base64.

Definition at line 60 of file MailMessage.h.

Public Types

typedef HeaderMap::const_iterator ConstIterator
typedef std::multimap
< std::string, std::string,
ILT > 
typedef HeaderMap::iterator Iterator
typedef std::vector
< MailRecipient

Public Member Functions

void add (const std::string &name, const std::string &value)
 Sets the value of the (first) name-value pair with the given name.
void addAttachment (const std::string &name, PartSource *pSource, ContentTransferEncoding encoding=ENCODING_BASE64)
void addContent (PartSource *pSource, ContentTransferEncoding encoding=ENCODING_QUOTED_PRINTABLE)
void addPart (const std::string &name, PartSource *pSource, ContentDisposition disposition, ContentTransferEncoding encoding)
 Returns true iff the message is a multipart message.
void addRecipient (const MailRecipient &recipient)
 Destroys the MailMessage.
ConstIterator begin () const
void clear ()
 Removes all name-value pairs with the given name.
bool empty () const
ConstIterator end () const
void erase (const std::string &name)
ConstIterator find (const std::string &name) const
const std::string & get (const std::string &name, const std::string &defaultValue) const
const std::string & get (const std::string &name) const
 Adds a new name-value pair with the given name and value.
const std::string & getContent () const
const std::string & getContentType () const
 Sets the content type for the message.
Poco::Timestamp getDate () const
 Sets the Date header to the given date/time value.
const std::string & getSender () const
const std::string & getSubject () const
 Sets the subject of the message.
bool has (const std::string &name) const
bool isMultipart () const
 Returns the value of the Date header.
const std::string & operator[] (const std::string &name) const
 Swaps the NameValueCollection with another one.
void read (std::istream &istr)
void read (std::istream &istr, PartHandler &handler)
const Recipients & recipients () const
 Adds a recipient for the message.
void set (const std::string &name, const std::string &value)
void setContent (const std::string &content, ContentTransferEncoding encoding=ENCODING_QUOTED_PRINTABLE)
void setContentType (const MediaType &mediaType)
 Sets the content type for the message.
void setContentType (const std::string &mediaType)
void setDate (const Poco::Timestamp &dateTime)
 Returns the content type for the message.
void setSender (const std::string &sender)
 Returns the subject of the message.
void setSubject (const std::string &subject)
 Returns the recipients of the message.
int size () const
 Returns true iff the header does not have any content.
void swap (NameValueCollection &nvc)
 Assigns the name-value pairs of another NameValueCollection to this one.
void write (std::ostream &ostr) const
virtual ~MailMessage ()
 Creates an empty MailMessage.

Static Public Member Functions

static void quote (const std::string &value, std::string &result, bool allowSpace=false)
static void splitElements (const std::string &s, std::vector< std::string > &elements, bool ignoreEmpty=true)
static void splitParameters (const std::string::const_iterator &begin, const std::string::const_iterator &end, NameValueCollection &parameters)
static void splitParameters (const std::string &s, std::string &value, NameValueCollection &parameters)

Protected Types

typedef std::vector< PartPartVec

Protected Member Functions

void handlePart (std::istream &istr, const MessageHeader &header, PartHandler &handler)
void makeMultipart ()
void readHeader (std::istream &istr)
void readMultipart (std::istream &istr, PartHandler &handler)
void readPart (std::istream &istr, const MessageHeader &header, PartHandler &handler)
void setRecipientHeaders (MessageHeader &headers) const
void writeEncoded (std::istream &istr, std::ostream &ostr, ContentTransferEncoding encoding) const
void writeHeader (const MessageHeader &header, std::ostream &ostr) const
void writeMultipart (MessageHeader &header, std::ostream &ostr) const
void writePart (MultipartWriter &writer, const Part &part) const

Static Protected Member Functions

static void appendRecipient (const MailRecipient &recipient, std::string &str)
static const std::string & contentTransferEncodingToString (ContentTransferEncoding encoding)
static int lineLength (const std::string &str)

Static Protected Attributes

static const std::string CTE_7BIT
static const std::string CTE_8BIT
static const std::string CTE_BASE64
static const std::string CTE_QUOTED_PRINTABLE
static const std::string EMPTY_HEADER
static const std::string HEADER_BCC
static const std::string HEADER_CC
static const std::string HEADER_CONTENT_DISPOSITION
static const std::string HEADER_CONTENT_TYPE
static const std::string HEADER_DATE
static const std::string HEADER_FROM
static const std::string HEADER_MIME_VERSION
static const std::string HEADER_SUBJECT
static const std::string HEADER_TO
static const std::string TEXT_PLAIN

Private Member Functions

 MailMessage (const MailMessage &)
MailMessageoperator= (const MailMessage &)

Private Attributes

std::string _content
ContentTransferEncoding _encoding
PartVec _parts
Recipients _recipients


struct  Part
 Writes the mail message to the given output stream. More...

The documentation for this class was generated from the following files:

Generated by  Doxygen 1.6.0   Back to index