aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorVincent Richard <[email protected]>2017-12-14 21:11:58 +0000
committerVincent Richard <[email protected]>2017-12-14 21:11:58 +0000
commitd7a1b5817e8389e9a4ea3d33c4dd250df9c6860c (patch)
tree699e0cb70c024209ee9106fbc442ce41968ec34c /src
parentFixed #186: use SMTPUTF8 only when needed. (diff)
downloadvmime-d7a1b5817e8389e9a4ea3d33c4dd250df9c6860c.tar.gz
vmime-d7a1b5817e8389e9a4ea3d33c4dd250df9c6860c.zip
Issue #186: SMTPUTF8 is not an argument to RCPT + UTF8 in recipient address must switch the whole message to SMTPUTF8.
Diffstat (limited to 'src')
-rw-r--r--src/vmime/net/smtp/SMTPCommand.cpp3
-rw-r--r--src/vmime/net/smtp/SMTPTransport.cpp22
2 files changed, 18 insertions, 7 deletions
diff --git a/src/vmime/net/smtp/SMTPCommand.cpp b/src/vmime/net/smtp/SMTPCommand.cpp
index 04c78722..27c8ec1b 100644
--- a/src/vmime/net/smtp/SMTPCommand.cpp
+++ b/src/vmime/net/smtp/SMTPCommand.cpp
@@ -153,9 +153,6 @@ shared_ptr <SMTPCommand> SMTPCommand::RCPT(const mailbox& mbox, const bool utf8)
cmd << ">";
- if (utf8)
- cmd << " SMTPUTF8";
-
return createCommand(cmd.str());
}
diff --git a/src/vmime/net/smtp/SMTPTransport.cpp b/src/vmime/net/smtp/SMTPTransport.cpp
index fb9ea9aa..25eb72a7 100644
--- a/src/vmime/net/smtp/SMTPTransport.cpp
+++ b/src/vmime/net/smtp/SMTPTransport.cpp
@@ -192,15 +192,29 @@ void SMTPTransport::sendEnvelope
if (needReset)
commands->addCommand(SMTPCommand::RSET());
- // Emit the "MAIL" command
+ // Check whether we need SMTPUTF8
const bool hasSMTPUTF8 = m_connection->hasExtension("SMTPUTF8");
+ bool needSMTPUTF8 = false;
+
+ if (!sender.isEmpty())
+ needSMTPUTF8 = needSMTPUTF8 || mailboxNeedsUTF8(sender);
+ else
+ needSMTPUTF8 = needSMTPUTF8 || mailboxNeedsUTF8(expeditor);
+
+ for (size_t i = 0 ; i < recipients.getMailboxCount() ; ++i)
+ {
+ const mailbox& mbox = *recipients.getMailboxAt(i);
+ needSMTPUTF8 = needSMTPUTF8 || mailboxNeedsUTF8(mbox);
+ }
+
+ // Emit the "MAIL" command
const bool hasSize = m_connection->hasExtension("SIZE");
if (!sender.isEmpty())
{
commands->addCommand(
SMTPCommand::MAIL(
- sender, hasSMTPUTF8 && mailboxNeedsUTF8(sender), hasSize ? size : 0
+ sender, hasSMTPUTF8 && needSMTPUTF8, hasSize ? size : 0
)
);
}
@@ -208,7 +222,7 @@ void SMTPTransport::sendEnvelope
{
commands->addCommand(
SMTPCommand::MAIL(
- expeditor, hasSMTPUTF8 && mailboxNeedsUTF8(expeditor), hasSize ? size : 0
+ expeditor, hasSMTPUTF8 && needSMTPUTF8, hasSize ? size : 0
)
);
}
@@ -220,7 +234,7 @@ void SMTPTransport::sendEnvelope
for (size_t i = 0 ; i < recipients.getMailboxCount() ; ++i)
{
const mailbox& mbox = *recipients.getMailboxAt(i);
- commands->addCommand(SMTPCommand::RCPT(mbox, hasSMTPUTF8 && mailboxNeedsUTF8(mbox)));
+ commands->addCommand(SMTPCommand::RCPT(mbox, hasSMTPUTF8 && needSMTPUTF8));
}
// Prepare sending of message data