aboutsummaryrefslogtreecommitdiffstats
path: root/src/net/smtp/SMTPCommand.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/net/smtp/SMTPCommand.cpp')
-rw-r--r--src/net/smtp/SMTPCommand.cpp29
1 files changed, 23 insertions, 6 deletions
diff --git a/src/net/smtp/SMTPCommand.cpp b/src/net/smtp/SMTPCommand.cpp
index 35ea56fb..d9f5c286 100644
--- a/src/net/smtp/SMTPCommand.cpp
+++ b/src/net/smtp/SMTPCommand.cpp
@@ -87,30 +87,47 @@ ref <SMTPCommand> SMTPCommand::STARTTLS()
// static
-ref <SMTPCommand> SMTPCommand::MAIL(const mailbox& mbox)
+ref <SMTPCommand> SMTPCommand::MAIL(const mailbox& mbox, const bool utf8)
{
std::ostringstream cmd;
cmd.imbue(std::locale::classic());
cmd << "MAIL FROM:<";
- vmime::utility::outputStreamAdapter cmd2(cmd);
- mbox.getEmail().generate(cmd2);
+ if (utf8)
+ {
+ cmd << mbox.getEmail().toText().getConvertedText(vmime::charsets::UTF_8);
+ }
+ else
+ {
+ vmime::utility::outputStreamAdapter cmd2(cmd);
+ mbox.getEmail().generate(cmd2);
+ }
cmd << ">";
+ if (utf8)
+ cmd << " SMTPUTF8";
+
return createCommand(cmd.str());
}
// static
-ref <SMTPCommand> SMTPCommand::RCPT(const mailbox& mbox)
+ref <SMTPCommand> SMTPCommand::RCPT(const mailbox& mbox, const bool utf8)
{
std::ostringstream cmd;
cmd.imbue(std::locale::classic());
cmd << "RCPT TO:<";
- vmime::utility::outputStreamAdapter cmd2(cmd);
- mbox.getEmail().generate(cmd2);
+ if (utf8)
+ {
+ cmd << mbox.getEmail().toText().getConvertedText(vmime::charsets::UTF_8);
+ }
+ else
+ {
+ vmime::utility::outputStreamAdapter cmd2(cmd);
+ mbox.getEmail().generate(cmd2);
+ }
cmd << ">";