diff options
author | Karen Arutyunov <karen@codesynthesis.com> | 2017-05-01 16:08:43 +0300 |
---|---|---|
committer | Karen Arutyunov <karen@codesynthesis.com> | 2017-05-01 16:59:24 +0300 |
commit | 61377c582e0f2675baa5f5e6e30a35d1a4164b33 (patch) | |
tree | 11cdca992834d7f7f197f72856712fbcb3020e3d /butl/sendmail | |
parent | 442c1a6790e52baa0c081f310d4d9e9b6f1ff638 (diff) |
Add hxx extension for headers and lib prefix for library dir
Diffstat (limited to 'butl/sendmail')
-rw-r--r-- | butl/sendmail | 91 |
1 files changed, 0 insertions, 91 deletions
diff --git a/butl/sendmail b/butl/sendmail deleted file mode 100644 index fe86285..0000000 --- a/butl/sendmail +++ /dev/null @@ -1,91 +0,0 @@ -// file : butl/sendmail -*- C++ -*- -// copyright : Copyright (c) 2014-2017 Code Synthesis Ltd -// license : MIT; see accompanying LICENSE file - -#ifndef BUTL_SENDMAIL -#define BUTL_SENDMAIL - -#include <string> - -#include <butl/export> - -#include <butl/process> -#include <butl/fdstream> -#include <butl/small-vector> - -namespace butl -{ - // Send email using the sendmail(1) program. - // - // Write the body of the email to out. Note that you must explicitly close - // it before calling wait(). Throw process_error and io_error (both derive - // from system_error) in case of errors. - // - // Typical usage: - // - // try - // { - // sendmail sm (2, // Diagnostics to stderr. - // "", // Default From: address. - // "Test subject", - // {"test@example.com"}); - // - // sm.out << "Test body" << endl; - // - // sm.out.close (); - // - // if (!sm.wait ()) - // ... // sendmail returned non-zero status. - // } - // catch (const std::system_error& e) - // { - // cerr << "sendmail error: " << e << endl; - // } - // - class LIBBUTL_EXPORT sendmail: public process - { - public: - ofdstream out; - - // Notes: - // - // - If from is empty then the process user's address is used. - // - // - The to/cc/bcc addressed should already be quoted if required. - // - using recipients_type = small_vector<std::string, 1>; - - template <typename E, typename... O> - sendmail (E&& err, - const std::string& from, - const std::string& subject, - const recipients_type& to, - const recipients_type& cc = recipients_type (), - const recipients_type& bcc = recipients_type (), - O&&... options); - - // Version with the command line callback (see process_run() for details). - // - template <typename C, typename E, typename... O> - sendmail (const C&, - E&& err, - const std::string& from, - const std::string& subject, - const recipients_type& to, - const recipients_type& cc = recipients_type (), - const recipients_type& bcc = recipients_type (), - O&&... options); - - private: - void - headers (const std::string& from, - const std::string& subj, - const recipients_type& to, - const recipients_type& cc, - const recipients_type& bcc); - }; -} - -#include <butl/sendmail.ixx> - -#endif // BUTL_SENDMAIL |