diff options
| author | Vincent Richard <[email protected]> | 2018-09-07 20:32:51 +0200 |
|---|---|---|
| committer | GitHub <[email protected]> | 2018-09-07 20:32:51 +0200 |
| commit | 71968d978daea9beffdc22522e8e9a29d52c3e9e (patch) | |
| tree | 48854151c452290f9e174765da3320ea845d5c50 /examples/example1.cpp | |
| parent | Add SMTPS with AUTH PLAIN without SASL (diff) | |
| parent | Useless mutex does not make nl_langinfo() thread-safe. (diff) | |
| download | vmime-71968d978daea9beffdc22522e8e9a29d52c3e9e.tar.gz vmime-71968d978daea9beffdc22522e8e9a29d52c3e9e.zip | |
Merge branch 'master' into master
Diffstat (limited to 'examples/example1.cpp')
| -rw-r--r-- | examples/example1.cpp | 43 |
1 files changed, 22 insertions, 21 deletions
diff --git a/examples/example1.cpp b/examples/example1.cpp index b80fe636..c698fa7f 100644 --- a/examples/example1.cpp +++ b/examples/example1.cpp @@ -1,6 +1,6 @@ // // VMime library (http://www.vmime.org) -// Copyright (C) 2002-2013 Vincent Richard <[email protected]> +// Copyright (C) 2002 Vincent Richard <[email protected]> // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public License as @@ -39,23 +39,20 @@ #include "vmime/platforms/posix/posixHandler.hpp" -int main() -{ +int main() { + std::cout << std::endl; // Set the global C and C++ locale to the user-configured locale. // The locale should use UTF-8 encoding for these tests to run successfully. - try - { + try { std::locale::global(std::locale("")); - } - catch (std::exception &) - { + } catch (std::exception &) { std::setlocale(LC_ALL, ""); } - try - { + try { + vmime::messageBuilder mb; // Fill in the basic fields @@ -74,9 +71,12 @@ int main() mb.setSubject(vmime::text("My first message generated with vmime::messageBuilder")); // Message body - mb.getTextPart()->setText(vmime::make_shared <vmime::stringContentHandler>( - "I'm writing this short text to test message construction " \ - "using the vmime::messageBuilder component.")); + mb.getTextPart()->setText( + vmime::make_shared <vmime::stringContentHandler>( + "I'm writing this short text to test message construction " \ + "using the vmime::messageBuilder component." + ) + ); // Construction vmime::shared_ptr <vmime::message> msg = mb.construct(); @@ -87,20 +87,21 @@ int main() vmime::utility::outputStreamAdapter out(std::cout); msg->generate(out); - } + // VMime exception - catch (vmime::exception& e) - { + } catch (vmime::exception& e) { + std::cout << "vmime::exception: " << e.what() << std::endl; throw; - } + // Standard exception - catch (std::exception& e) - { + } catch (std::exception& e) { + std::cout << "std::exception: " << e.what() << std::endl; - //throw; + throw; } std::cout << std::endl; -} + return 0; +} |
