diff --git a/src/Wt/Mail/Message.C b/src/Wt/Mail/Message.C index 4d1c7cf9..30797660 100644 --- a/src/Wt/Mail/Message.C +++ b/src/Wt/Mail/Message.C @@ -51,6 +51,8 @@ void Message::Header::setValue(const std::string& value) value_ = value; } +Mailbox Message::EMPTY_MAILBOX; + Message::Message() { } @@ -61,7 +63,13 @@ void Message::setFrom(const Mailbox& from) void Message::setReplyTo(const Mailbox& replyTo) { - replyTo_ = replyTo; + replyTos_.clear(); + addReplyTo(replyTo); +} + +void Message::addReplyTo(const Mailbox &replyTo) +{ + replyTos_.push_back(replyTo); } void Message::setSubject(const WString& subject) @@ -181,8 +189,8 @@ void Message::write(std::ostream& out) const if (!date_.isNull()) out << "Date: " << date_.toString("ddd, dd MMM yyyy HH:mm:ss Z") << "\r\n"; - if (!replyTo_.empty()) - replyTo_.write("Reply-To", out); + for (const Mailbox& replyTo : replyTos_) + replyTo.write("Reply-To", out); if (!subject_.empty()) { out << "Subject: "; diff --git a/src/Wt/Mail/Message.h b/src/Wt/Mail/Message.h index 52934c09..e6527d2a 100644 --- a/src/Wt/Mail/Message.h +++ b/src/Wt/Mail/Message.h @@ -118,11 +118,21 @@ public: */ void setReplyTo(const Mailbox& replyTo); - /*! \brief Returns the reply-to mailbox. + /*! \brief Adds a reply-to mailbox + */ + void addReplyTo(const Mailbox& replyTo); + + /*! \brief Returns the first reply-to mailbox. * * \sa setReplyTo() */ - const Mailbox& replyTo() const { return replyTo_; } + const Mailbox& replyTo() const { return replyTos_.empty() ? EMPTY_MAILBOX : replyTos_.front(); } + + /*! \brief Returns all the reply-to mailboxes. + * + * \sa addReplyTo() + */ + const std::vector& replyTos() const { return replyTos_; } /*! \brief Sets a subject. */ @@ -232,7 +242,8 @@ private: std::istream *data; }; - Mailbox from_, replyTo_; + Mailbox from_; + std::vector replyTos_; std::vector recipients_; std::vector
headers_; std::vector attachments_; @@ -249,6 +260,8 @@ private: bool quoteIfNeeded); static void encodeQuotedPrintable(const WString& text, std::ostream& out); + static Mailbox EMPTY_MAILBOX; + friend class Mailbox; };