diff options
author | eportnov <eportnov@ibs.ru> | 2022-09-12 16:46:44 +0300 |
---|---|---|
committer | eportnov <eportnov@ibs.ru> | 2022-09-12 16:46:44 +0300 |
commit | cdb7ae4c729b6a6c51b57eeefd21574952a4b767 (patch) | |
tree | c465900180840832e241ca5419dd90b429459588 /src/message/sender.hpp | |
parent | 9fa4addff6f90a8b5697a594e034f5517d64dd25 (diff) | |
download | obmc-sila-smtp-cdb7ae4c729b6a6c51b57eeefd21574952a4b767.tar.xz |
refactoringfeature/refactor
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 ); + }; +} + + |