diff options
Diffstat (limited to 'examples/example1.cpp')
-rw-r--r-- | examples/example1.cpp | 26 |
1 files changed, 18 insertions, 8 deletions
diff --git a/examples/example1.cpp b/examples/example1.cpp index 191a2adf..b639a4bc 100644 --- a/examples/example1.cpp +++ b/examples/example1.cpp @@ -45,14 +45,24 @@ int main() vmime::messageBuilder mb; // Fill in the basic fields - mb.expeditor() = vmime::mailbox("[email protected]"); - mb.recipients().append(vmime::mailbox("[email protected]")); - mb.blindCopyRecipients().append(vmime::mailbox("[email protected]")); - mb.subject() = vmime::text("My first message generated with vmime::messageBuilder"); + mb.setExpeditor(vmime::mailbox("[email protected]")); + + vmime::addressList to; + to.appendAddress(new vmime::mailbox("[email protected]")); + + mb.setRecipients(to); + + vmime::addressList bcc; + bcc.appendAddress(new vmime::mailbox("[email protected]")); + + mb.setBlindCopyRecipients(bcc); + + mb.setSubject(vmime::text("My first message generated with vmime::messageBuilder")); // Message body - mb.textPart().text() = "I'm writing this short text to test message construction " \ - "using the vmime::messageBuilder component."; + mb.getTextPart()->setText(vmime::contentHandler( + "I'm writing this short text to test message construction " \ + "using the vmime::messageBuilder component.")); // Construction vmime::message* msg = mb.construct(); @@ -61,7 +71,7 @@ int main() std::cout << "Generated message:" << std::endl; std::cout << "==================" << std::endl; - vmime::outputStreamAdapter out(std::cout); + vmime::utility::outputStreamAdapter out(std::cout); msg->generate(out); // Destruction @@ -77,7 +87,7 @@ int main() catch (std::exception& e) { std::cout << "std::exception: " << e.what() << std::endl; - throw; + //throw; } std::cout << std::endl; |