diff options
author | Vincent Richard <[email protected]> | 2009-12-13 12:50:36 +0000 |
---|---|---|
committer | Vincent Richard <[email protected]> | 2009-12-13 12:50:36 +0000 |
commit | 45faafdced71b05271f87c0963c0d5e5b4595f4e (patch) | |
tree | fa41674a75fb8fc1140d681b66579d65b6663bf9 | |
parent | Fixed non thread-safe getLocalCharset() function (thanks to Bartek Szurgot). (diff) | |
download | vmime-45faafdced71b05271f87c0963c0d5e5b4595f4e.tar.gz vmime-45faafdced71b05271f87c0963c0d5e5b4595f4e.zip |
Makes 'To' optional, like 'Cc' and 'Bcc'. An exception is still thrown if there are no recipients at all (see bug #2912670).
-rw-r--r-- | src/messageBuilder.cpp | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/src/messageBuilder.cpp b/src/messageBuilder.cpp index a70372fb..870d59e7 100644 --- a/src/messageBuilder.cpp +++ b/src/messageBuilder.cpp @@ -54,11 +54,17 @@ ref <message> messageBuilder::construct() const if (m_from.isEmpty()) throw exceptions::no_expeditor(); - if (m_to.isEmpty() || m_to.getAddressAt(0)->isEmpty()) + if ((m_to.isEmpty() || m_to.getAddressAt(0)->isEmpty()) && + (m_cc.isEmpty() || m_cc.getAddressAt(0)->isEmpty()) && + (m_bcc.isEmpty() || m_bcc.getAddressAt(0)->isEmpty())) + { throw exceptions::no_recipient(); + } msg->getHeader()->From()->setValue(m_from); - msg->getHeader()->To()->setValue(m_to); + + if (!m_to.isEmpty()) + msg->getHeader()->To()->setValue(m_to); if (!m_cc.isEmpty()) msg->getHeader()->Cc()->setValue(m_cc); |