mirror of
https://github.com/pocoproject/poco.git
synced 2025-05-29 07:25:53 +02:00
#3219: SMTPClientSession: invalid SMTP command if empty recipients list in MailMessage
This commit is contained in:
parent
5c2cd1a4ff
commit
2f9c7cd6d3
@ -419,6 +419,7 @@ void SMTPClientSession::sendCommands(const MailMessage& message, const Recipient
|
|||||||
std::ostringstream recipient;
|
std::ostringstream recipient;
|
||||||
if (pRecipients)
|
if (pRecipients)
|
||||||
{
|
{
|
||||||
|
if (pRecipients->empty()) throw Poco::InvalidArgumentException("attempting to send message with empty recipients list");
|
||||||
for (const auto& rec: *pRecipients)
|
for (const auto& rec: *pRecipients)
|
||||||
{
|
{
|
||||||
recipient << '<' << rec << '>';
|
recipient << '<' << rec << '>';
|
||||||
@ -429,6 +430,7 @@ void SMTPClientSession::sendCommands(const MailMessage& message, const Recipient
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
if (message.recipients().empty()) throw Poco::InvalidArgumentException("attempting to send message with empty recipients list");
|
||||||
for (const auto& rec: message.recipients())
|
for (const auto& rec: message.recipients())
|
||||||
{
|
{
|
||||||
recipient << '<' << rec.getAddress() << '>';
|
recipient << '<' << rec.getAddress() << '>';
|
||||||
@ -465,6 +467,7 @@ void SMTPClientSession::sendAddresses(const std::string& from, const Recipients&
|
|||||||
|
|
||||||
std::ostringstream recipient;
|
std::ostringstream recipient;
|
||||||
|
|
||||||
|
if (recipients.empty()) throw Poco::InvalidArgumentException("attempting to send message with empty recipients list");
|
||||||
for (const auto& rec: recipients)
|
for (const auto& rec: recipients)
|
||||||
{
|
{
|
||||||
recipient << '<' << rec << '>';
|
recipient << '<' << rec << '>';
|
||||||
|
Loading…
x
Reference in New Issue
Block a user