diff options
Diffstat (limited to 'src/message/sender.hpp')
-rw-r--r-- | src/message/sender.hpp | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/src/message/sender.hpp b/src/message/sender.hpp new file mode 100644 index 0000000..e75faa8 --- /dev/null +++ b/src/message/sender.hpp @@ -0,0 +1,38 @@ +#pragma once + +#include <list> +#include <memory> + +#include <curl/curl.h> + +#include "service/settings.hpp" + +namespace smtp::message +{ + struct WriteThis + { + int counter; + }; + + class Sender + { + public: + Sender( service::Settings const& settings_storage ); + ~Sender() = default; + + bool Send( std::string const& mail_from, std::string const& mail_to, std::list<std::string> const& cc, + std::string const& subject, std::string const& text ); + private: + void UpdateMailText( std::string const& mail_from, std::string const& mail_to, std::list<std::string> const& cc, + std::string const& subject, std::string const& textt ) const; + void InitSenders( std::string const& mail_from, std::list<std::string> const& mail_to ); + void FillRecipients( CURL* curl, std::string const& mail_to, std::list<std::string> const& cc, curl_slist* recipients ); + std::string GetHostPortData() const; + static size_t ReadCallBack( void *ptr, size_t size, size_t nmemb, void *userp ); + + service::Settings const& mSettingsStorage; + bool InitCurl( CURL* curl, WriteThis const& upload_ctx, std::string const& mail_from ); + }; +} + + |