Skip to content

Commit

Permalink
d
Browse files Browse the repository at this point in the history
  • Loading branch information
xicopitz committed May 10, 2015
1 parent 79959ad commit 20cc337
Show file tree
Hide file tree
Showing 26 changed files with 341 additions and 17 deletions.
17 changes: 0 additions & 17 deletions .gitattributes

This file was deleted.

22 changes: 22 additions & 0 deletions EmailReader.sln
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 2013
VisualStudioVersion = 12.0.31101.0
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "EmailReader", "EmailReader\EmailReader.csproj", "{7AD8B7DB-4C1F-4D1A-82CD-39D43A787D2C}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{7AD8B7DB-4C1F-4D1A-82CD-39D43A787D2C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{7AD8B7DB-4C1F-4D1A-82CD-39D43A787D2C}.Debug|Any CPU.Build.0 = Debug|Any CPU
{7AD8B7DB-4C1F-4D1A-82CD-39D43A787D2C}.Release|Any CPU.ActiveCfg = Release|Any CPU
{7AD8B7DB-4C1F-4D1A-82CD-39D43A787D2C}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
EndGlobal
Binary file added EmailReader.v12.suo
Binary file not shown.
6 changes: 6 additions & 0 deletions EmailReader/App.config
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5" />
</startup>
</configuration>
61 changes: 61 additions & 0 deletions EmailReader/EmailReader.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http:https://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{7AD8B7DB-4C1F-4D1A-82CD-39D43A787D2C}</ProjectGuid>
<OutputType>Exe</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>EmailReader</RootNamespace>
<AssemblyName>EmailReader</AssemblyName>
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="EAGetMail">
<HintPath>C:\Program Files (x86)\EAGetMail\EAGetMail.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Data" />
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="Program.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<ItemGroup>
<None Include="App.config" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">
</Target>
<Target Name="AfterBuild">
</Target>
-->
</Project>
70 changes: 70 additions & 0 deletions EmailReader/Program.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
using System;
using System.Collections.Generic;
using System.Text;
using System.IO;
using EAGetMail; //add EAGetMail namespace

namespace receiveemail
{
class Program
{
static void Main(string[] args)
{
// Create a folder named "inbox" under current directory
string curpath = Directory.GetCurrentDirectory();
string mailbox = String.Format("{0}\\inbox", curpath);

// If the folder is not existed, create it.
if (!Directory.Exists(mailbox))
{
Directory.CreateDirectory(mailbox);
}

MailServer oServer = new MailServer("pop3.live.com","email", "pass", ServerProtocol.Pop3);
MailClient oClient = new MailClient("TryIt");

// Enable SSL connection.
oServer.SSLConnection = true;

// Set 995 SSL port
oServer.Port = 995;

try
{
oClient.Connect(oServer);
MailInfo[] infos = oClient.GetMailInfos();
for (int i = 0; i < infos.Length; i++)
{
MailInfo info = infos[i];
Console.WriteLine("Index: {0}; Size: {1}; UIDL: {2}",info.Index, info.Size, info.UIDL);

// Receive email from POP3 server
Mail oMail = oClient.GetMail(info);

Console.WriteLine("From: {0}", oMail.From.ToString());
Console.WriteLine("Subject: {0}\r\n", oMail.Subject);

// Generate an email file name based on date time.
System.DateTime d = System.DateTime.Now;
System.Globalization.CultureInfo cur = new System.Globalization.CultureInfo("pt-PT");
string sdate = d.ToString("yyyyMMddHHmmss", cur);
string fileName = String.Format("{0}\\{1}{2}{3}.eml", mailbox, sdate, d.Millisecond.ToString("d3"), i);

// Save email to local disk
oMail.SaveAs(fileName, true);
Console.Write("Novo email\n");
Console.Write("");

// Mark email as deleted from POP3 server.
//oClient.Delete(info);
}
oClient.Quit();
}
catch (Exception ep)
{
Console.WriteLine(ep.Message);
}

}
}
}
36 changes: 36 additions & 0 deletions EmailReader/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;

// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("EmailReader")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("EmailReader")]
[assembly: AssemblyCopyright("Copyright © 2015")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]

// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]

// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("63025212-1ea5-4ae2-ad06-d2901d6f0495")]

// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
12 changes: 12 additions & 0 deletions EmailReader/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# EmailReader
Read Emails from Google/Microsoft

Experiments with C# reading emails from Google and Microsoft email accounts.

Commits:

1 - Initial Commit: just reading and save emails

2 - Read & Process: Read, store and organize emails locally

3 - Read & Process 2: Add Organize by sender and post information to Firebase DB
Binary file added EmailReader/bin/Debug/EAGetMail.dll
Binary file not shown.
Binary file added EmailReader/bin/Debug/EmailReader.exe
Binary file not shown.
6 changes: 6 additions & 0 deletions EmailReader/bin/Debug/EmailReader.exe.config
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5" />
</startup>
</configuration>
Binary file added EmailReader/bin/Debug/EmailReader.pdb
Binary file not shown.
Binary file added EmailReader/bin/Debug/EmailReader.vshost.exe
Binary file not shown.
6 changes: 6 additions & 0 deletions EmailReader/bin/Debug/EmailReader.vshost.exe.config
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5" />
</startup>
</configuration>
11 changes: 11 additions & 0 deletions EmailReader/bin/Debug/EmailReader.vshost.exe.manifest
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
<assemblyIdentity version="1.0.0.0" name="MyApplication.app"/>
<trustInfo xmlns="urn:schemas-microsoft-com:asm.v2">
<security>
<requestedPrivileges xmlns="urn:schemas-microsoft-com:asm.v3">
<requestedExecutionLevel level="asInvoker" uiAccess="false"/>
</requestedPrivileges>
</security>
</trustInfo>
</assembly>
Binary file added EmailReader/bin/Debug/emailresponse.txt
Binary file not shown.
52 changes: 52 additions & 0 deletions EmailReader/bin/Debug/inbox/201505100117158790.eml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
x-store-info:sbevkl2QZR7OXo7WID5ZcVBK1Phj2jX/
Authentication-Results: hotmail.com; spf=pass (sender IP is 209.85.217.173; identity alignment result is pass and alignment mode is relaxed) smtp.mailfrom=[email protected]; dkim=pass (identity alignment result is pass and alignment mode is relaxed) header.d=gmail.com; x-hmca=pass header.id=[email protected]
X-SID-PRA: [email protected]
X-AUTH-Result: PASS
X-SID-Result: PASS
X-Message-Status: n:n
X-Message-Delivery: Vj0xLjE7dXM9MDtsPTA7YT0xO0Q9MTtHRD0xO1NDTD0w
X-Message-Info: gamVN+8Ez8V+RHg+F+brASzNo7OWnReFSX9I8cIyOqdJDXExZfaWhhgOidEYxnhWrcIXjRPDq3MYYlDe1SL1uE7wyRIFTMUCOu2QflGH64MeLfiwuKFs9564+e9Nk2WtciUOBOkOE2oK8hg2lVZND++WzIMlHBgz/poilnuCVLG7tAanhFKQbWR/OFYafz7ROwk8IpsDyI2s32WAo4gIGi32FTk5pkzG
Received: from mail-lb0-f173.google.com ([209.85.217.173]) by COL004-MC6F8.hotmail.com over TLS secured channel with Microsoft SMTPSVC(7.5.7601.23008);
Sat, 9 May 2015 17:01:49 -0700
Received: by mail-lb0-f173.google.com with SMTP id zk7so73700698lbb.0
for <[email protected]>; Sat, 09 May 2015 17:01:49 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=gmail.com; s=20120113;
h=mime-version:date:message-id:subject:from:to:content-type;
bh=7L3sFZ5t/bQq34rM4QUWHO3a9RDgIi7ZueR//EGx2hA=;
b=v6CgzvgD0HEkHFxylQBwLRc7XuTVlytPff9uQ4ICiLMk3nK3iYMG0DTLnFA/9ZMMb9
Y6i8PmVHg82sEInRUZFIO/kv8XU+c66Ub44j0801heaG5dPEMqBQffMm7ffRJV3tIJb8
Q/3gj+7f5Fgqt97s3XxnkZjeTVih2mTD6yooEGve+Cxwoy2CDdAkPlkigLPzEfPuzKq/
eh9xGHN/nK3SUC2MiAoNDhOI/qtrclH+HoQl6C58YWo+X6wB3eNUKZWS2VLz3D3yhHuJ
1pHzRPSY2wtBYf7RfB3DEs0N1aIPebHz1lLYQ0U4weMI1WwYh0BAxnjD2S5lZnwMy3T0
MqTA==
MIME-Version: 1.0
X-Received: by 10.152.27.194 with SMTP id v2mr2713914lag.75.1431216109271;
Sat, 09 May 2015 17:01:49 -0700 (PDT)
Received: by 10.152.123.243 with HTTP; Sat, 9 May 2015 17:01:49 -0700 (PDT)
Date: Sun, 10 May 2015 01:01:49 +0100
Message-ID: <CAGYhEvLEB6enPvfd3BtunpzG7PHD65ah-Y-OCKbWROreYhYt4Q@mail.gmail.com>
Subject: teste
From: Francisco Coelho <[email protected]>
To: [email protected]
Content-Type: multipart/alternative; boundary=089e0158c2acca3de60515aef751
Return-Path: [email protected]
X-OriginalArrivalTime: 10 May 2015 00:01:49.0680 (UTC) FILETIME=[83631700:01D08AB4]

--089e0158c2acca3de60515aef751
Content-Type: text/plain; charset=UTF-8
ola
--
Cumprimentos,

Francisco Coelho

--089e0158c2acca3de60515aef751
Content-Type: text/html; charset=UTF-8

<div dir="ltr">ola<br clear="all"><div><br></div>-- <br><div class="gmail_signature"><div dir="ltr">Cumprimentos,<div><br></div><div>Francisco Coelho</div></div></div>
</div>

--089e0158c2acca3de60515aef751--
52 changes: 52 additions & 0 deletions EmailReader/bin/Debug/inbox/201505100117528761.eml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
x-store-info:sbevkl2QZR7OXo7WID5ZcdV2tiiWGqTnL8LqRHZDpO1LljV8CY4abg/x/aBZ7kZpOA7dp8CMP2jBJlGe2j1u8/yJCqK230PpRDa2iNgE1Pw9+RCROH4YPHF7VXyHqufaJTeKBnBcRG4=
Authentication-Results: hotmail.com; spf=pass (sender IP is 209.85.215.54; identity alignment result is pass and alignment mode is relaxed) smtp.mailfrom=[email protected]; dkim=pass (identity alignment result is pass and alignment mode is relaxed) header.d=gmail.com; x-hmca=pass header.id=[email protected]
X-SID-PRA: [email protected]
X-AUTH-Result: PASS
X-SID-Result: PASS
X-Message-Status: n:n
X-Message-Delivery: Vj0xLjE7dXM9MDtsPTA7YT0xO0Q9MTtHRD0xO1NDTD0w
X-Message-Info: gamVN+8Ez8V+RHg+F+brAYB6YuYFvoZRxGGTzCA1a0Bg2+W1EmAQ0y7LV85VDuhISOEBJaPR9XzuU9NwBxU+XEMfaah7K0ZHX7qaD16WJHwh+DO7oA7jKS2WGIIXdkJW+7bFHkMmZ1z3+HrML6hoGhqZSCpHxJUyB5BcSqdgxDHG4+s87YrZ1XQKsXFXDPBYXg1hmfNzwUxIwmoGdGx6/XqU+thCeuk+
Received: from mail-la0-f54.google.com ([209.85.215.54]) by SNT004-MC3F24.hotmail.com over TLS secured channel with Microsoft SMTPSVC(7.5.7601.23008);
Sat, 9 May 2015 17:16:51 -0700
Received: by mail-la0-f54.google.com with SMTP id v1so73179999lag.3
for <[email protected]>; Sat, 09 May 2015 17:16:50 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=gmail.com; s=20120113;
h=mime-version:date:message-id:subject:from:to:content-type;
bh=ZJDWuJ1xR4f9khSKhpkg7Ty60K91rjhdRdSuZ1y4N4Y=;
b=RaCik+cuQb0oM48lOEU9Svi7iHCNZc9o2nMxFuhVWZeF/1Sf+hB03hB8GxkDAsoWAi
VE9yxrlZJEr1oG8G5jnQJ4LZuKNyECyw59bAGy9H/+1L1XqA2NvqsQVr/e9WK4zMPVte
S8CHTxUazuwvmCsdB5mz6p7bIOZ0zuW3XUw8H8ahxJxzjMY1IKQNyWOchRaO9u5mSJlk
8IzJB7j2m+PSRK/HH1qps1y1+eDT0fpX927PbTIADTwiQ5+LguGFvWzIA6907RSWQjud
sPzzeYWvlSOpfV11GtZP80GuN3JuJhhLUjp51aKg8NxXfL4wIN7n/qGTAXBEwtaZVKe9
cJ2Q==
MIME-Version: 1.0
X-Received: by 10.112.205.69 with SMTP id le5mr3275806lbc.65.1431217010551;
Sat, 09 May 2015 17:16:50 -0700 (PDT)
Received: by 10.152.123.243 with HTTP; Sat, 9 May 2015 17:16:50 -0700 (PDT)
Date: Sun, 10 May 2015 01:16:50 +0100
Message-ID: <CAGYhEvJ8mhR42z6Kza0DKKF2S80-T3oz=[email protected]>
Subject: ggggggggggg
From: Francisco Coelho <[email protected]>
To: [email protected]
Content-Type: multipart/alternative; boundary=001a11c3c1be82b0de0515af2dc4
Return-Path: [email protected]
X-OriginalArrivalTime: 10 May 2015 00:16:51.0085 (UTC) FILETIME=[9CAA93D0:01D08AB6]

--001a11c3c1be82b0de0515af2dc4
Content-Type: text/plain; charset=UTF-8
jjjjjjjjjjjjjjjj
--
Cumprimentos,

Francisco Coelho

--001a11c3c1be82b0de0515af2dc4
Content-Type: text/html; charset=UTF-8

<div dir="ltr">jjjjjjjjjjjjjjjj<br clear="all"><div><br></div>-- <br><div class="gmail_signature"><div dir="ltr">Cumprimentos,<div><br></div><div>Francisco Coelho</div></div></div>
</div>

--001a11c3c1be82b0de0515af2dc4--
Binary file not shown.
7 changes: 7 additions & 0 deletions EmailReader/obj/Debug/EmailReader.csproj.FileListAbsolute.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
D:\DEVELOPMENT\Github\EmailReader\EmailReader\bin\Debug\EmailReader.exe.config
D:\DEVELOPMENT\Github\EmailReader\EmailReader\bin\Debug\EmailReader.exe
D:\DEVELOPMENT\Github\EmailReader\EmailReader\bin\Debug\EmailReader.pdb
D:\DEVELOPMENT\Github\EmailReader\EmailReader\obj\Debug\EmailReader.csprojResolveAssemblyReference.cache
D:\DEVELOPMENT\Github\EmailReader\EmailReader\obj\Debug\EmailReader.exe
D:\DEVELOPMENT\Github\EmailReader\EmailReader\obj\Debug\EmailReader.pdb
D:\DEVELOPMENT\Github\EmailReader\EmailReader\bin\Debug\EAGetMail.dll
Binary file not shown.
Binary file added EmailReader/obj/Debug/EmailReader.exe
Binary file not shown.
Binary file added EmailReader/obj/Debug/EmailReader.pdb
Binary file not shown.
Empty file.
Empty file.
Empty file.

0 comments on commit 20cc337

Please sign in to comment.