summaryrefslogtreecommitdiff
path: root/src/file/mail.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/file/mail.cpp')
-rw-r--r--src/file/mail.cpp41
1 files changed, 41 insertions, 0 deletions
diff --git a/src/file/mail.cpp b/src/file/mail.cpp
new file mode 100644
index 0000000..14e6228
--- /dev/null
+++ b/src/file/mail.cpp
@@ -0,0 +1,41 @@
+#include <fstream>
+
+#include "mail.hpp"
+
+namespace smtp::file
+{
+ Mail::Mail( std::string const& path_file )
+ : PathFile( path_file )
+ {
+
+ }
+
+ std::list<std::string> Mail::Read() const
+ {
+ std::ifstream mail_file{ PathFile };
+ if ( !mail_file.is_open() )
+ {
+ //TODO new file
+ // std::cerr << "Failed to open pcie_devices database \n";
+ }
+ std::string line{};
+ std::list<std::string> result;
+
+ while ( std::getline( mail_file, line ) )
+ {
+ auto parsed_data = GetMailFromLine( line );
+ if( parsed_data )
+ {
+ result.push_back( *parsed_data );
+ }
+ }
+ return result;
+ }
+
+ std::optional<std::string> Mail::GetMailFromLine( std::string const& line ) const
+ {
+ //TODO parsing
+ return line;
+ }
+
+}