Browse Source

Initial commit

michel 3 năm trước cách đây
commit
054e04e1f0

+ 363 - 0
.gitignore

@@ -0,0 +1,363 @@
+## Ignore Visual Studio temporary files, build results, and
+## files generated by popular Visual Studio add-ons.
+##
+## Get latest from https://github.com/github/gitignore/blob/master/VisualStudio.gitignore
+
+# User-specific files
+*.rsuser
+*.suo
+*.user
+*.userosscache
+*.sln.docstates
+
+# User-specific files (MonoDevelop/Xamarin Studio)
+*.userprefs
+
+# Mono auto generated files
+mono_crash.*
+
+# Build results
+[Dd]ebug/
+[Dd]ebugPublic/
+[Rr]elease/
+[Rr]eleases/
+x64/
+x86/
+[Ww][Ii][Nn]32/
+[Aa][Rr][Mm]/
+[Aa][Rr][Mm]64/
+bld/
+[Bb]in/
+[Oo]bj/
+[Oo]ut/
+[Ll]og/
+[Ll]ogs/
+
+# Visual Studio 2015/2017 cache/options directory
+.vs/
+# Uncomment if you have tasks that create the project's static files in wwwroot
+#wwwroot/
+
+# Visual Studio 2017 auto generated files
+Generated\ Files/
+
+# MSTest test Results
+[Tt]est[Rr]esult*/
+[Bb]uild[Ll]og.*
+
+# NUnit
+*.VisualState.xml
+TestResult.xml
+nunit-*.xml
+
+# Build Results of an ATL Project
+[Dd]ebugPS/
+[Rr]eleasePS/
+dlldata.c
+
+# Benchmark Results
+BenchmarkDotNet.Artifacts/
+
+# .NET Core
+project.lock.json
+project.fragment.lock.json
+artifacts/
+
+# ASP.NET Scaffolding
+ScaffoldingReadMe.txt
+
+# StyleCop
+StyleCopReport.xml
+
+# Files built by Visual Studio
+*_i.c
+*_p.c
+*_h.h
+*.ilk
+*.meta
+*.obj
+*.iobj
+*.pch
+*.pdb
+*.ipdb
+*.pgc
+*.pgd
+*.rsp
+*.sbr
+*.tlb
+*.tli
+*.tlh
+*.tmp
+*.tmp_proj
+*_wpftmp.csproj
+*.log
+*.vspscc
+*.vssscc
+.builds
+*.pidb
+*.svclog
+*.scc
+
+# Chutzpah Test files
+_Chutzpah*
+
+# Visual C++ cache files
+ipch/
+*.aps
+*.ncb
+*.opendb
+*.opensdf
+*.sdf
+*.cachefile
+*.VC.db
+*.VC.VC.opendb
+
+# Visual Studio profiler
+*.psess
+*.vsp
+*.vspx
+*.sap
+
+# Visual Studio Trace Files
+*.e2e
+
+# TFS 2012 Local Workspace
+$tf/
+
+# Guidance Automation Toolkit
+*.gpState
+
+# ReSharper is a .NET coding add-in
+_ReSharper*/
+*.[Rr]e[Ss]harper
+*.DotSettings.user
+
+# TeamCity is a build add-in
+_TeamCity*
+
+# DotCover is a Code Coverage Tool
+*.dotCover
+
+# AxoCover is a Code Coverage Tool
+.axoCover/*
+!.axoCover/settings.json
+
+# Coverlet is a free, cross platform Code Coverage Tool
+coverage*.json
+coverage*.xml
+coverage*.info
+
+# Visual Studio code coverage results
+*.coverage
+*.coveragexml
+
+# NCrunch
+_NCrunch_*
+.*crunch*.local.xml
+nCrunchTemp_*
+
+# MightyMoose
+*.mm.*
+AutoTest.Net/
+
+# Web workbench (sass)
+.sass-cache/
+
+# Installshield output folder
+[Ee]xpress/
+
+# DocProject is a documentation generator add-in
+DocProject/buildhelp/
+DocProject/Help/*.HxT
+DocProject/Help/*.HxC
+DocProject/Help/*.hhc
+DocProject/Help/*.hhk
+DocProject/Help/*.hhp
+DocProject/Help/Html2
+DocProject/Help/html
+
+# Click-Once directory
+publish/
+
+# Publish Web Output
+*.[Pp]ublish.xml
+*.azurePubxml
+# Note: Comment the next line if you want to checkin your web deploy settings,
+# but database connection strings (with potential passwords) will be unencrypted
+*.pubxml
+*.publishproj
+
+# Microsoft Azure Web App publish settings. Comment the next line if you want to
+# checkin your Azure Web App publish settings, but sensitive information contained
+# in these scripts will be unencrypted
+PublishScripts/
+
+# NuGet Packages
+*.nupkg
+# NuGet Symbol Packages
+*.snupkg
+# The packages folder can be ignored because of Package Restore
+**/[Pp]ackages/*
+# except build/, which is used as an MSBuild target.
+!**/[Pp]ackages/build/
+# Uncomment if necessary however generally it will be regenerated when needed
+#!**/[Pp]ackages/repositories.config
+# NuGet v3's project.json files produces more ignorable files
+*.nuget.props
+*.nuget.targets
+
+# Microsoft Azure Build Output
+csx/
+*.build.csdef
+
+# Microsoft Azure Emulator
+ecf/
+rcf/
+
+# Windows Store app package directories and files
+AppPackages/
+BundleArtifacts/
+Package.StoreAssociation.xml
+_pkginfo.txt
+*.appx
+*.appxbundle
+*.appxupload
+
+# Visual Studio cache files
+# files ending in .cache can be ignored
+*.[Cc]ache
+# but keep track of directories ending in .cache
+!?*.[Cc]ache/
+
+# Others
+ClientBin/
+~$*
+*~
+*.dbmdl
+*.dbproj.schemaview
+*.jfm
+*.pfx
+*.publishsettings
+orleans.codegen.cs
+
+# Including strong name files can present a security risk
+# (https://github.com/github/gitignore/pull/2483#issue-259490424)
+#*.snk
+
+# Since there are multiple workflows, uncomment next line to ignore bower_components
+# (https://github.com/github/gitignore/pull/1529#issuecomment-104372622)
+#bower_components/
+
+# RIA/Silverlight projects
+Generated_Code/
+
+# Backup & report files from converting an old project file
+# to a newer Visual Studio version. Backup files are not needed,
+# because we have git ;-)
+_UpgradeReport_Files/
+Backup*/
+UpgradeLog*.XML
+UpgradeLog*.htm
+ServiceFabricBackup/
+*.rptproj.bak
+
+# SQL Server files
+*.mdf
+*.ldf
+*.ndf
+
+# Business Intelligence projects
+*.rdl.data
+*.bim.layout
+*.bim_*.settings
+*.rptproj.rsuser
+*- [Bb]ackup.rdl
+*- [Bb]ackup ([0-9]).rdl
+*- [Bb]ackup ([0-9][0-9]).rdl
+
+# Microsoft Fakes
+FakesAssemblies/
+
+# GhostDoc plugin setting file
+*.GhostDoc.xml
+
+# Node.js Tools for Visual Studio
+.ntvs_analysis.dat
+node_modules/
+
+# Visual Studio 6 build log
+*.plg
+
+# Visual Studio 6 workspace options file
+*.opt
+
+# Visual Studio 6 auto-generated workspace file (contains which files were open etc.)
+*.vbw
+
+# Visual Studio LightSwitch build output
+**/*.HTMLClient/GeneratedArtifacts
+**/*.DesktopClient/GeneratedArtifacts
+**/*.DesktopClient/ModelManifest.xml
+**/*.Server/GeneratedArtifacts
+**/*.Server/ModelManifest.xml
+_Pvt_Extensions
+
+# Paket dependency manager
+.paket/paket.exe
+paket-files/
+
+# FAKE - F# Make
+.fake/
+
+# CodeRush personal settings
+.cr/personal
+
+# Python Tools for Visual Studio (PTVS)
+__pycache__/
+*.pyc
+
+# Cake - Uncomment if you are using it
+# tools/**
+# !tools/packages.config
+
+# Tabs Studio
+*.tss
+
+# Telerik's JustMock configuration file
+*.jmconfig
+
+# BizTalk build output
+*.btp.cs
+*.btm.cs
+*.odx.cs
+*.xsd.cs
+
+# OpenCover UI analysis results
+OpenCover/
+
+# Azure Stream Analytics local run output
+ASALocalRun/
+
+# MSBuild Binary and Structured Log
+*.binlog
+
+# NVidia Nsight GPU debugger configuration file
+*.nvuser
+
+# MFractors (Xamarin productivity tool) working folder
+.mfractor/
+
+# Local History for Visual Studio
+.localhistory/
+
+# BeatPulse healthcheck temp database
+healthchecksdb
+
+# Backup folder for Package Reference Convert tool in Visual Studio 2017
+MigrationBackup/
+
+# Ionide (cross platform F# VS Code tools) working folder
+.ionide/
+
+# Fody - auto-generated XML schema
+FodyWeavers.xsd

+ 26 - 0
.vscode/launch.json

@@ -0,0 +1,26 @@
+{
+    "version": "0.2.0",
+    "configurations": [
+        {
+            // Use IntelliSense to find out which attributes exist for C# debugging
+            // Use hover for the description of the existing attributes
+            // For further information visit https://github.com/OmniSharp/omnisharp-vscode/blob/master/debugger-launchjson.md
+            "name": ".NET Core Launch (console)",
+            "type": "coreclr",
+            "request": "launch",
+            "preLaunchTask": "build",
+            // If you have changed target frameworks, make sure to update the program path.
+            "program": "${workspaceFolder}/MailFromWho/bin/Debug/net6.0/MailFromWho.dll",
+            "args": [],
+            "cwd": "${workspaceFolder}/MailFromWho",
+            // For more information about the 'console' field, see https://aka.ms/VSCode-CS-LaunchJson-Console
+            "console": "integratedTerminal",
+            "stopAtEntry": false
+        },
+        {
+            "name": ".NET Core Attach",
+            "type": "coreclr",
+            "request": "attach"
+        }
+    ]
+}

+ 41 - 0
.vscode/tasks.json

@@ -0,0 +1,41 @@
+{
+    "version": "2.0.0",
+    "tasks": [
+        {
+            "label": "build",
+            "command": "dotnet",
+            "type": "process",
+            "args": [
+                "build",
+                "${workspaceFolder}/MailFromWho/MailFromWho.csproj",
+                "/property:GenerateFullPaths=true",
+                "/consoleloggerparameters:NoSummary"
+            ],
+            "problemMatcher": "$msCompile"
+        },
+        {
+            "label": "publish",
+            "command": "dotnet",
+            "type": "process",
+            "args": [
+                "publish",
+                "${workspaceFolder}/MailFromWho/MailFromWho.csproj",
+                "/property:GenerateFullPaths=true",
+                "/consoleloggerparameters:NoSummary"
+            ],
+            "problemMatcher": "$msCompile"
+        },
+        {
+            "label": "watch",
+            "command": "dotnet",
+            "type": "process",
+            "args": [
+                "watch",
+                "run",
+                "--project",
+                "${workspaceFolder}/MailFromWho/MailFromWho.csproj"
+            ],
+            "problemMatcher": "$msCompile"
+        }
+    ]
+}

+ 98 - 0
MailFromWho/Format.cs

@@ -0,0 +1,98 @@
+using System.Text;
+using System.Text.RegularExpressions;
+
+namespace MailFromWho
+{
+    internal class Format
+    {
+        private readonly Settings _settings;
+
+        public Format(Settings settings)
+        {
+            _settings = settings;
+        }
+
+        internal void CreateCSV()
+        {
+            string? line;
+            Dictionary<string, List<string>> addresses = new Dictionary<string, List<string>>();
+
+            // Read the file and display it line by line.  
+            var inFile = new System.IO.StreamReader(_settings.IntermediateFile);
+            using (var outFile = new System.IO.StreamWriter(_settings.CsvFile))
+            {
+                while ((line = inFile.ReadLine()) != null)
+                {
+                    char[] quotes = { '\"' };
+                    var emailAddress = ExtractEmails(line);
+                    if (emailAddress != null)
+                    {
+                        emailAddress = emailAddress.ToLower();
+                        var alias = line.Replace($"<{emailAddress}>", "").Trim().Trim(quotes);
+                        if (addresses.ContainsKey(emailAddress))
+                        {
+                            var aliasses = addresses[emailAddress];
+                            if (!aliasses.Contains(alias))
+                            {
+                                aliasses.Add(alias);
+                            }
+                        }
+                        else
+                        {
+                            var aliasses = new List<string>();
+                            if (!string.IsNullOrEmpty(alias))
+                            {
+                                aliasses.Add(alias);
+                            }
+                            addresses.Add(emailAddress, aliasses);
+                        }
+                    }
+                }
+
+                List<KeyValuePair<string, List<string>>> addressList = addresses.ToList();
+
+                addressList.Sort(
+                    delegate (KeyValuePair<string, List<string>> pair1,
+                    KeyValuePair<string, List<string>> pair2)
+                    {
+                        var emailRegex = new Regex(@"\w+([-+.]\w+)*@(?<domain>\w+([-.]\w+)*\.\w+([-.]\w+)*)",
+                            RegexOptions.IgnoreCase);
+                        var domain1 = emailRegex.Match(pair1.Key).Groups["domain"].Value;
+                        var domain2 = emailRegex.Match(pair2.Key).Groups["domain"].Value;
+
+                        return domain1.CompareTo(domain2);
+                    }
+                );
+
+                foreach (var address in addressList)
+                {
+                    var sb = new StringBuilder(address.Key);
+                    foreach (var alias in address.Value)
+                    {
+                        sb.Append(',').Append(alias);
+                    }
+
+                    var outLine = sb.ToString();
+                    System.Console.WriteLine(outLine);
+                    outFile.WriteLine(outLine);
+                }
+            }
+
+            inFile.Close();
+        }
+
+        public string? ExtractEmails(string lineIn)
+        {
+            var emailRegex = new Regex(@"\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*",
+                RegexOptions.IgnoreCase);
+            //find items that matches with our pattern
+            var emailMatches = emailRegex.Matches(lineIn);
+
+            foreach (Match emailMatch in emailMatches)
+            {
+                return emailMatch.Value;
+            }
+            return null;
+        }
+    }
+}

+ 232 - 0
MailFromWho/Imap.cs

@@ -0,0 +1,232 @@
+using System.Net.Security;
+using System.Net.Sockets;
+using System.Text;
+using System.Text.RegularExpressions;
+
+namespace MailFromWho
+{
+    internal class Imap
+    {
+#pragma warning disable CS8618 // Non-nullable field must contain a non-null value when exiting constructor. Consider declaring as nullable.
+        private static StreamWriter _sw;
+        private static TcpClient _tcpc;
+        private static SslStream _ssl;
+#pragma warning restore CS8618 // Non-nullable field must contain a non-null value when exiting constructor. Consider declaring as nullable.
+
+        private readonly Settings _settings;
+
+        public Imap(Settings settings)
+        {
+            _settings = settings;
+        }
+
+        internal void GetAllAddresses()
+        {
+            try
+            {
+                var path = Environment.CurrentDirectory + $"{Path.DirectorySeparatorChar}{_settings.IntermediateFile}";
+                var username = _settings.UserName;
+                var imapServer = _settings.ImapServer;
+                var sslPort = _settings.SslPort;
+                var password = string.Empty;
+
+                while (string.IsNullOrEmpty(password))
+                {
+                    Console.Write($"Enter password of '{username}' @ '{imapServer}': ");
+                    var fgColour = Console.ForegroundColor;
+                    Console.ForegroundColor = Console.BackgroundColor;
+                    password = Console.ReadLine();
+                    Console.ForegroundColor = fgColour;
+                }
+
+                if (System.IO.File.Exists(path))
+                {
+                    System.IO.File.Delete(path);
+                }
+
+                _sw = new System.IO.StreamWriter(System.IO.File.Create(path));
+                // there should be no gap between the imap command and the \r\n       
+                // ssl.read() -- while ssl.readbyte!= eof does not work because there is no eof from server 
+                // cannot check for \r\n because in case of larger response from server ex:read email message 
+                // there are lot of lines so \r \n appears at the end of each line 
+                //ssl.timeout sets the underlying tcp connections timeout if the read or write 
+                //time out exceeds then the undelying connection is closed 
+                _tcpc = new System.Net.Sockets.TcpClient(imapServer, sslPort);
+
+                _ssl = new System.Net.Security.SslStream(_tcpc.GetStream());
+                _ssl.ReadTimeout = 200;
+                _ssl.AuthenticateAsClient(imapServer);
+                receiveResponse();
+
+                sendRequest("$ LOGIN " + username + " " + password + "\r\n");
+                receiveResponse();
+
+                // Get all folders
+                sendRequest("$ LIST " + "\"\"" + " \"*\"" + "\r\n");
+                var foldersRaw = receiveResponse();
+                var matches = Regex.Matches(foldersRaw, @"\s(INBOX.*?)\r\n");
+                var folders = new List<string>();
+                foreach (Match match in matches)
+                {
+                    folders.Add(match.Groups[1].Value.Replace("\"", ""));
+                }
+
+
+                foreach (var folder in folders)
+                {
+                    sendRequest($"$ SELECT \"{folder}\"\r\n");
+                    receiveResponse();
+
+                    sendRequest($"$ STATUS \"{folder}\" (MESSAGES)\r\n");
+                    var statusRaw = receiveResponse();
+                    var regex = new Regex(@"MESSAGES.(\d+)");
+                    var aantalBerichten = int.Parse(regex.Match(statusRaw).Groups[1].Value);
+
+                    var outputStr = $"FOLDER {folder} heeft {aantalBerichten} berichten";
+                    WriteOutput(outputStr, true);
+
+                    sendRequest("$ FETCH 1:* body[header.fields (from)]\r\n");
+                    var fromRaw = receiveResponse();
+                    // From: "flypacificblue.com" <reservations@flypacificblue.com>
+                    //matches = Regex.Matches(fromRaw, "From:\\s\\\"?(.[^\"]*?)\\\"?\\<(.*)\\>\r\n");
+                    matches = Regex.Matches(fromRaw, @"From:\s(.*)\r\n");
+                    var froms = new List<string>();
+                    foreach (Match match in matches)
+                    {
+                        var addressLine = match.Groups[1].Value;
+                        froms.Add(addressLine);
+                        WriteOutput(addressLine, true);
+                    }
+                    WriteOutput("", true);
+                }
+
+                receiveResponse();
+
+
+                sendRequest("$ LOGOUT\r\n");
+                receiveResponse();
+            }
+            catch (Exception ex)
+            {
+                Console.WriteLine("error: " + ex.Message);
+            }
+            finally
+            {
+                if (_sw != null)
+                {
+                    _sw.WriteLine("");
+                    _sw.Close();
+                    _sw.Dispose();
+                }
+                if (_ssl != null)
+                {
+                    _ssl.Close();
+                    _ssl.Dispose();
+                }
+                if (_tcpc != null)
+                {
+                    _tcpc.Close();
+                }
+            }
+        }
+
+        private void WriteOutput(string outputStr, bool newline)
+        {
+            Console.Write(outputStr);
+            _sw.Write(outputStr);
+
+            if (newline)
+            {
+                Console.WriteLine("");
+                _sw.WriteLine("");
+            }
+        }
+
+        private void sendRequest(string command)
+        {
+            byte[] dummy;
+
+            try
+            {
+                if (command != "")
+                {
+                    if (_tcpc.Connected)
+                    {
+                        dummy = Encoding.ASCII.GetBytes(command);
+                        _ssl.Write(dummy, 0, dummy.Length);
+                    }
+                    else
+                    {
+                        throw new ApplicationException("TCP CONNECTION DISCONNECTED");
+                    }
+                }
+                _ssl.Flush();
+            }
+            catch (Exception ex)
+            {
+                throw new ApplicationException(ex.Message);
+            }
+        }
+
+
+        private string receiveResponse()
+        {
+            var sb = new StringBuilder();
+            byte[] buffer;
+
+            try
+            {
+                var bytes = 0;
+                // First wait for some data, but not too long...
+                var waitTime = DateTime.Now.AddMilliseconds(200);
+                while (bytes <= 0 && DateTime.Now < waitTime)
+                {
+                    try
+                    {
+                        buffer = new byte[2048];
+                        bytes = _ssl.Read(buffer, 0, 2048);
+                        sb.Append(ReturnCleanASCII(Encoding.ASCII.GetString(buffer, 0, bytes)));
+                    }
+                    catch (IOException)
+                    {
+                        bytes = -1;
+                    }
+                }
+                while (bytes > 0)
+                {
+                    try
+                    {
+                        buffer = new byte[2048];
+                        bytes = _ssl.Read(buffer, 0, 2048);
+                        sb.Append(ReturnCleanASCII(Encoding.ASCII.GetString(buffer, 0, bytes)));
+                    }
+                    catch (IOException)
+                    {
+                        bytes = -1;
+                    }
+                }
+            }
+            catch (Exception ex)
+            {
+                throw new ApplicationException(ex.Message);
+            }
+            return sb.ToString();
+        }
+
+
+        private string ReturnCleanASCII(string s)
+        {
+            StringBuilder sb = new StringBuilder(s.Length);
+            foreach (char c in s)
+            {
+                int i = (int)c;
+                if (i > 127) // you probably don't want 127 either
+                    continue;
+                if (i < 32 && (i != 10 && i != 13))  // I bet you don't want control characters 
+                    continue;
+                sb.Append(c);
+            }
+            return sb.ToString();
+        }
+    }
+}

+ 25 - 0
MailFromWho/MailFromWho.csproj

@@ -0,0 +1,25 @@
+<Project Sdk="Microsoft.NET.Sdk">
+
+  <PropertyGroup>
+    <OutputType>Exe</OutputType>
+    <TargetFramework>net6.0</TargetFramework>
+    <ImplicitUsings>enable</ImplicitUsings>
+    <Nullable>enable</Nullable>
+  </PropertyGroup>
+
+  <ItemGroup>
+    <None Remove="appsettings.json" />
+  </ItemGroup>
+
+  <ItemGroup>
+    <Content Include="appsettings.json">
+      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
+    </Content>
+  </ItemGroup>
+
+  <ItemGroup>
+    <PackageReference Include="Microsoft.Extensions.Configuration.Binder" Version="6.0.0" />
+    <PackageReference Include="Microsoft.Extensions.Configuration.Json" Version="6.0.0" />
+  </ItemGroup>
+
+</Project>

+ 11 - 0
MailFromWho/Program.cs

@@ -0,0 +1,11 @@
+using MailFromWho;
+using Microsoft.Extensions.Configuration;
+
+IConfiguration config = new ConfigurationBuilder()
+    .AddJsonFile("appsettings.json")
+    .Build();
+
+Settings settings = config.GetRequiredSection("Settings").Get<Settings>();
+
+new Imap(settings).GetAllAddresses();
+new Format(settings).CreateCSV();

+ 8 - 0
MailFromWho/Settings.cs

@@ -0,0 +1,8 @@
+public class Settings
+{
+    public string UserName { get; set; } = String.Empty;
+    public string ImapServer { get; set; } = String.Empty;
+    public int SslPort { get; set; }
+    public string IntermediateFile { get; set; } = String.Empty;
+    public string CsvFile { get; set; } = String.Empty;
+}

+ 9 - 0
MailFromWho/appsettings.json

@@ -0,0 +1,9 @@
+{
+  "Settings": {
+    "UserName": "someone@freedom.nl",
+    "ImapServer": "imap.freedom.nl",
+    "SslPort": "993",
+    "IntermediateFile": "AllFromAddresses.txt",
+    "CsvFile": "Adressen.csv"
+  }
+}

+ 30 - 0
MailTool.sln

@@ -0,0 +1,30 @@
+
+Microsoft Visual Studio Solution File, Format Version 12.00
+# Visual Studio Version 17
+VisualStudioVersion = 17.1.32210.238
+MinimumVisualStudioVersion = 10.0.40219.1
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MailFromWho", "MailFromWho\MailFromWho.csproj", "{6400D60C-AF84-4412-B2FE-4C0F8456BCC2}"
+EndProject
+Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{014291FE-557C-4220-81B7-92582660308A}"
+	ProjectSection(SolutionItems) = preProject
+		README.md = README.md
+	EndProjectSection
+EndProject
+Global
+	GlobalSection(SolutionConfigurationPlatforms) = preSolution
+		Debug|Any CPU = Debug|Any CPU
+		Release|Any CPU = Release|Any CPU
+	EndGlobalSection
+	GlobalSection(ProjectConfigurationPlatforms) = postSolution
+		{6400D60C-AF84-4412-B2FE-4C0F8456BCC2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+		{6400D60C-AF84-4412-B2FE-4C0F8456BCC2}.Debug|Any CPU.Build.0 = Debug|Any CPU
+		{6400D60C-AF84-4412-B2FE-4C0F8456BCC2}.Release|Any CPU.ActiveCfg = Release|Any CPU
+		{6400D60C-AF84-4412-B2FE-4C0F8456BCC2}.Release|Any CPU.Build.0 = Release|Any CPU
+	EndGlobalSection
+	GlobalSection(SolutionProperties) = preSolution
+		HideSolutionNode = FALSE
+	EndGlobalSection
+	GlobalSection(ExtensibilityGlobals) = postSolution
+		SolutionGuid = {129EAE46-9F94-4727-ACE7-3F9CD4F8C560}
+	EndGlobalSection
+EndGlobal

+ 26 - 0
README.md

@@ -0,0 +1,26 @@
+# MAIL FROM WHO
+Tool to retrieve all e-mail addresses from a configured user. The e-mail addresses will be written in a CSV-file,
+ordered by the domains of the senders. 
+## Configuration
+In the project you'll find the file **appsetttings.json**, in which you have to configure
+- Username - Used to log in to the mail account. Sometimes this is only the name (john), or the complete e-mail
+address (john@mail.com)
+- ImapServer - FQDN of the IMAP server
+- SslPort - SSL port to use on the IMAP server. Usualy 993
+- IntermediateFile - In this file the tool will store all e-mail addresses (unsorted and likely with duplicates)
+- CsvFile - End result in CSV-format. The first column contains the e-mail addresses, the following the name(s) use with
+the address (can also be none), e.g.
+	- john@mail.com,John,John Doe
+
+The tool will prompt for the password. For security reasons, the password can't be stored in the configuration.
+## Building
+This project use .NET core 6. It can be build easily on Windows with Visual Studio 2022 Community edition 
+https://visualstudio.microsoft.com/vs/community/
+
+For other systems consult https://dotnet.microsoft.com/en-us/download/dotnet/6.0 to download the SDK.
+### Command line
+Building from the command line can be done from within the project folder.
+```
+dotnet build
+```
+