Wt  4.11.1
Loading...
Searching...
No Matches
Wt::Mail::Mailbox Class Reference

An email sender or recipient mailbox. More...

#include <Wt/Mail/Mailbox.h>

Public Member Functions

 Mailbox ()
 Default constructor.
 Mailbox (const std::string &address)
 Constructs a mailbox using an address.
 Mailbox (const std::string &address, const WString &displayName)
 Constructs a mailbox using an address and display name.
bool empty () const
 Returns whether the mailbox is empty.
void write (const std::string &header, std::ostream &out) const
 Write the mailbox to the stream, with the header and adding a new line (CLRF).
void append (std::ostream &out) const
 Adds the mailbox to the stream, without adding a new line (CLRF).
const std::string & address () const
 Returns the email address.
const WStringdisplayName () const
 Returns the display name.

Detailed Description

An email sender or recipient mailbox.

Constructor & Destructor Documentation

◆ Mailbox() [1/2]

Wt::Mail::Mailbox::Mailbox ( )

Default constructor.

Creates an empty() mailbox.

◆ Mailbox() [2/2]

Wt::Mail::Mailbox::Mailbox ( const std::string & address)

Constructs a mailbox using an address.

Constructs a mailbox which is only defined by an email address (i.e. without a display name).

Member Function Documentation

◆ address()

const std::string & Wt::Mail::Mailbox::address ( ) const

Returns the email address.

Returns "" if empty()

◆ append()

void Wt::Mail::Mailbox::append ( std::ostream & out) const

Adds the mailbox to the stream, without adding a new line (CLRF).

This will append to a line on the stream, and is formatted like:

const std::string & address() const
Returns the email address.
Definition Mailbox.h:75
const WString & displayName() const
Returns the display name.
Definition Mailbox.h:79

This displayName is optional, and can be left empty.

◆ write()

void Wt::Mail::Mailbox::write ( const std::string & header,
std::ostream & out ) const

Write the mailbox to the stream, with the header and adding a new line (CLRF).

This will generate a line on the stream that is formatted like:

{header}: {displayName} <{address}> CLRF

This displayName is optional, and can be left empty.