1 #ifndef LIBJMMCG_UNIX_CURL_HPP
2 #define LIBJMMCG_UNIX_CURL_HPP
22 #include "core/config.h"
24 #include <boost/noncopyable.hpp>
31 #include <curl/curl.h>
51 bool empty()
const noexcept(
true);
56 curl_slist * recipients_=
nullptr;
63 curl(
std::string
const &smtp_url,
unsigned short port,
std::string
const &username,
std::string
const &password,
bool enable_logging,
bool enable_ssl_verification=
false)
noexcept(
false);
64 ~
curl()
noexcept(
true);
69 void from(
std::string
const &from)
noexcept(
true);
76 friend std::ostream &operator<<(
std::ostream &os,
curl const &c)
noexcept(
false) {
77 os<<
"SMTP server: '"<<c.smtp_url_<<
"'"
78 ", logon username: '"<<c.username_<<
"'"
79 ", from: '"<<c.from_<<
"'.";
85 struct upload_status {
90 const std::string smtp_url_;
91 const std::string username_;
92 const std::string password_;
94 upload_status upload_ctx_;
96 static payload_message_t payload_text_strs_;
101 void ignore_ssl_verification()
noexcept(
true);
106 void set_logging()
noexcept(
true);
108 static std::string current_time_for_email()
noexcept(
false);
109 void create_message(
std::string
const &to,
std::string
const &subject,
std::string
const &body)
const noexcept(
false);
110 static size_t payload_source(
void *ptr, size_t size, size_t nmemb,
void *userp);