From 2949fb51f13e1236d5c161f02e1c2c8541100e9f Mon Sep 17 00:00:00 2001 From: Vincent Richard Date: Thu, 21 Oct 2004 15:05:47 +0000 Subject: Refactoring (see ChangeLog). --- examples/example3.cpp | 25 +++++++++++++++++-------- 1 file changed, 17 insertions(+), 8 deletions(-) (limited to 'examples/example3.cpp') diff --git a/examples/example3.cpp b/examples/example3.cpp index c8cc0f2f..d2b41754 100644 --- a/examples/example3.cpp +++ b/examples/example3.cpp @@ -45,10 +45,19 @@ int main() vmime::messageBuilder mb; // Fill in the basic fields - mb.expeditor() = vmime::mailbox("me@somewhere.com"); - mb.recipients().append(vmime::mailbox("you@elsewhere.com")); - mb.blindCopyRecipients().append(vmime::mailbox("you-bcc@nowhere.com")); - mb.subject() = vmime::text("My first message generated with vmime::messageBuilder"); + mb.setExpeditor(vmime::mailbox("me@somewhere.com")); + + vmime::addressList to; + to.appendAddress(new vmime::mailbox("you@elsewhere.com")); + + mb.setRecipients(to); + + vmime::addressList bcc; + bcc.appendAddress(new vmime::mailbox("you-bcc@nowhere.com")); + + mb.setBlindCopyRecipients(bcc); + + mb.setSubject(vmime::text("My first message generated with vmime::messageBuilder")); // Set the content-type to "text/html" mb.constructTextPart(vmime::mediaType @@ -56,16 +65,16 @@ int main() // Fill in the text part: the message is available in two formats: HTML and plain text. // HTML text part also includes an inline image (embedded into the message). - vmime::htmlTextPart& textPart = dynamic_cast(mb.textPart()); + vmime::htmlTextPart& textPart = dynamic_cast(*mb.getTextPart()); // -- embed an image (the returned "CID" (content identifier) is used to reference // -- the image into HTML content). - vmime::string cid = textPart.embeddedObjects.add("<...IMAGE DATA...>", + vmime::string cid = textPart.addObject("<...IMAGE DATA...>", vmime::mediaType(vmime::mediaTypes::IMAGE, vmime::mediaTypes::IMAGE_JPEG)); // -- message text - textPart.text() = vmime::string("This is the HTML text.
"); - textPart.plainText() = vmime::string("This is the plain text (without HTML formatting)."); + textPart.setText(vmime::contentHandler(vmime::string("This is the HTML text.
"))); + textPart.setPlainText(vmime::contentHandler(vmime::string("This is the plain text (without HTML formatting)."))); // Construction vmime::message* msg = mb.construct(); -- cgit v1.2.3