summaryrefslogtreecommitdiffstats
path: root/SendGrid/SendGridMail
diff options
context:
space:
mode:
Diffstat (limited to 'SendGrid/SendGridMail')
-rw-r--r--SendGrid/SendGridMail/Exceptions/InvalidApiRequestException.cs19
-rw-r--r--SendGrid/SendGridMail/ISendGrid.cs302
-rw-r--r--SendGrid/SendGridMail/Mail.csproj154
-rw-r--r--SendGrid/SendGridMail/Properties/AssemblyInfo.cs62
-rw-r--r--SendGrid/SendGridMail/SendGrid.cs550
-rw-r--r--SendGrid/SendGridMail/SendGridMail.pfxbin1709 -> 0 bytes
-rw-r--r--SendGrid/SendGridMail/StreamedFileBody.cs39
-rw-r--r--SendGrid/SendGridMail/Transport/ErrorChecker.cs57
-rw-r--r--SendGrid/SendGridMail/Transport/ITransport.cs18
-rw-r--r--SendGrid/SendGridMail/Transport/Web.cs186
-rw-r--r--SendGrid/SendGridMail/Web/IWebApi.cs45
-rw-r--r--SendGrid/SendGridMail/app.config3
-rw-r--r--SendGrid/SendGridMail/nuget/Sendgrid.2.1.1.nuspec24
-rw-r--r--SendGrid/SendGridMail/nuget/lib/SendGridMail.dllbin25600 -> 0 bytes
-rw-r--r--SendGrid/SendGridMail/packages.config4
-rw-r--r--SendGrid/SendGridMail/sendgrid-csharp.snkbin596 -> 0 bytes
16 files changed, 0 insertions, 1463 deletions
diff --git a/SendGrid/SendGridMail/Exceptions/InvalidApiRequestException.cs b/SendGrid/SendGridMail/Exceptions/InvalidApiRequestException.cs
deleted file mode 100644
index 7fd51ea..0000000
--- a/SendGrid/SendGridMail/Exceptions/InvalidApiRequestException.cs
+++ /dev/null
@@ -1,19 +0,0 @@
-using System;
-using System.Net;
-
-namespace Exceptions
-{
- public class InvalidApiRequestException : Exception
- {
- public InvalidApiRequestException(HttpStatusCode httpStatusCode, string[] errors, string httpResponsePhrase)
- : base(httpResponsePhrase + " Check `Errors` for a list of errors returned by the API.")
- {
- ResponseStatusCode = httpStatusCode;
- Errors = errors;
- }
-
- public String[] Errors { get; set; }
-
- public HttpStatusCode ResponseStatusCode { get; private set; }
- }
-}
diff --git a/SendGrid/SendGridMail/ISendGrid.cs b/SendGrid/SendGridMail/ISendGrid.cs
deleted file mode 100644
index 38a931a..0000000
--- a/SendGrid/SendGridMail/ISendGrid.cs
+++ /dev/null
@@ -1,302 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.IO;
-using System.Net.Mail;
-using SendGrid.SmtpApi;
-
-namespace SendGrid
-{
- /// <summary>
- /// Represents the basic set of functions that will be called by the user
- /// includes basic message data manipulation and filter settings
- /// </summary>
- public interface ISendGrid
- {
- #region Properties
-
- MailAddress From { get; set; }
- MailAddress[] To { get; set; }
- MailAddress[] Cc { get; set; }
- MailAddress[] Bcc { get; set; }
- MailAddress[] ReplyTo { get; set; }
- Dictionary<String, MemoryStream> StreamedAttachments { get; set; }
- String[] Attachments { get; set; }
- String Subject { get; set; }
- Dictionary<String, String> Headers { get; set; }
- IHeader Header { get; set; }
- String Html { get; set; }
- String Text { get; set; }
-
- #endregion
-
- #region Interface for ITransport
-
- /// <summary>
- /// Used by the Transport object to create a MIME for SMTP
- /// </summary>
- /// <returns>MIME to be sent</returns>
- MailMessage CreateMimeMessage();
-
- #endregion
-
- #region Methods for setting data
-
- /// <summary>
- /// Add to the 'To' address.
- /// </summary>
- /// <param name="address">single string eg. 'you@company.com'</param>
- void AddTo(String address);
-
- /// <summary>
- /// Add to the 'To' address.
- /// </summary>
- /// <param name="addresses">list of email addresses as strings</param>
- void AddTo(IEnumerable<String> addresses);
-
- /// <summary>
- /// Add to the 'To' address.
- /// </summary>
- /// <param name="addresssInfo">
- /// the dictionary keys are the email addresses, which points to a dictionary of
- /// key substitutionValues pairs mapping to other address codes, such as { foo@bar.com => { 'DisplayName' => 'Mr Foo' }
- /// }
- /// </param>
- void AddTo(IDictionary<String, IDictionary<String, String>> addresssInfo);
-
- /// <summary>
- /// Defines a mapping between a replacement string in the text of the message to a section of
- /// substitution values to be used
- /// </summary>
- /// <param name="replacementTag">the string in the email that you'll replace eg. '-itemsOrdered-'</param>
- /// <param name="sectionValue">
- /// The content that will be substituted in for the replacementTag
- /// </param>
- void AddSection(String replacementTag, String sectionValue);
-
- /// <summary>
- /// Defines a mapping between a replacement string in the text of the message to a list of
- /// substitution values to be used, one per each recipient, in the same order as the recipients were added.
- /// </summary>
- /// <param name="replacementTag">the string in the email that you'll replace eg. '-name-'</param>
- /// <param name="substitutionValues">
- /// a list of values that will be substituted in for the replacementTag, one for each
- /// recipient
- /// </param>
- void AddSubstitution(String replacementTag, List<String> substitutionValues);
-
- /// <summary>
- /// This adds parameters and values that will be bassed back through SendGrid's
- /// Event API if an event notification is triggered by this email.
- /// </summary>
- /// <param name="identifiers">parameter substitutionValues pairs to be passed back on event notification</param>
- void AddUniqueArgs(IDictionary<String, String> identifiers);
-
- /// <summary>
- /// This sets the suppression group id for this email.
- /// </summary>
- /// <param name="id">the id of the suppression group</param>
- void SetAsmGroupId(int id);
-
- /// <summary>
- /// This sets the category for this email. Statistics are stored on a per category
- /// basis, so this can be useful for tracking on a per group basis.
- /// </summary>
- /// <param name="category">categories applied to the message</param>
- void SetCategory(String category);
-
- /// <summary>
- /// This sets the categories for this email. Statistics are stored on a per category
- /// basis, so this can be useful for tracking on a per group basis.
- /// </summary>
- /// <param name="categories">categories applied to the message</param>
- void SetCategories(IEnumerable<String> categories);
-
- /// <summary>
- /// This sets the IP Pool for this email.
- /// </summary>
- /// <param name="pool">The name of the pool with which to send the message.</param>
- void SetIpPool(String pool);
-
- /// <summary>
- /// Define a send_at timestamp to schedule this send for the future.
- /// </summary>
- /// <param name="sendTime">The time at which to send the email</param>
- void SetSendAt(DateTime sendTime);
-
- /// <summary>
- /// Define a send_each_at timestamp to schedule individual send times per message
- /// </summary>
- /// <param name="sendTimes">The times at which to send the emails</param>
- void SetSendEachAt(IEnumerable<DateTime> sendTimes);
-
- /// <summary>
- /// Add an attachment to the message.
- /// </summary>
- /// <param name="filePath">a fully qualified file path as a string</param>
- void AddAttachment(String filePath);
-
- /// <summary>
- /// Add a stream as an attachment to the message
- /// </summary>
- /// <param name="stream">Stream of file to be attached</param>
- /// <param name="name">Name of file to be attached</param>
- void AddAttachment(Stream stream, String name);
-
- void EmbedStreamImage(Stream stream, String name);
-
- /// <summary>
- /// GetRecipients returns a list of all the recepients by retrieving the to, cc, and bcc lists.
- /// </summary>
- /// <returns></returns>
- IEnumerable<String> GetRecipients();
-
- /// <summary>
- /// Add custom headers to the message
- /// </summary>
- /// <param name="headers">key substitutionValues pairs</param>
- void AddHeaders(IDictionary<String, String> headers);
-
- /// <summary>
- /// Gets the list of embedded images
- /// </summary>
- /// <returns></returns>
- IDictionary<string, string> GetEmbeddedImages();
-
- #endregion
-
- #region SMTP API Functions
-
- /// <summary>
- /// Disable the gravatar app
- /// </summary>
- void DisableGravatar();
-
- /// <summary>
- /// Disable the open tracking app
- /// </summary>
- void DisableOpenTracking();
-
- /// <summary>
- /// Disable the click tracking app
- /// </summary>
- void DisableClickTracking();
-
- /// <summary>
- /// Disable the spam check
- /// </summary>
- void DisableSpamCheck();
-
- /// <summary>
- /// Disable the unsubscribe app
- /// </summary>
- void DisableUnsubscribe();
-
- /// <summary>
- /// Disable the footer app
- /// </summary>
- void DisableFooter();
-
- /// <summary>
- /// Disable the Google Analytics app
- /// </summary>
- void DisableGoogleAnalytics();
-
- /// <summary>
- /// Disable the templates app
- /// </summary>
- void DisableTemplate();
-
- /// <summary>
- /// Disable Bcc app
- /// </summary>
- void DisableBcc();
-
- /// <summary>
- /// Disable the Bypass List Management app
- /// </summary>
- void DisableBypassListManagement();
-
- /// <summary>
- /// Inserts the gravatar image of the sender to the bottom of the message
- /// </summary>
- void EnableGravatar();
-
- /// <summary>
- /// Adds an invisible image to the end of the email which can track e-mail opens.
- /// </summary>
- void EnableOpenTracking();
-
- /// <summary>
- /// Causes all links to be overwritten, shortened, and pointed to SendGrid's servers so clicks will be tracked.
- /// </summary>
- /// <param name="includePlainText">true if links found in plain text portions of the message are to be overwritten</param>
- void EnableClickTracking(bool includePlainText = false);
-
- /// <summary>
- /// Provides notification when emails are deteched that exceed a predefined spam threshold.
- /// </summary>
- /// <param name="score">
- /// Emails with a SpamAssassin score over this substitutionValues will be considered spam and not be
- /// delivered.
- /// </param>
- /// <param name="url">SendGridMessage will send an HTTP POST request to this url when a message is detected as spam</param>
- void EnableSpamCheck(int score = 5, String url = null);
-
- /// <summary>
- /// Allow's SendGridMessage to manage unsubscribes and ensure these users don't get future emails from the sender
- /// </summary>
- /// <param name="text">String for the plain text email body showing what you want the message to look like.</param>
- /// <param name="html">String for the HTML email body showing what you want the message to look like.</param>
- void EnableUnsubscribe(String text, String html);
-
- /// <summary>
- /// Allow's SendGridMessage to manage unsubscribes and ensure these users don't get future emails from the sender
- /// </summary>
- /// <param name="replace">Tag in the message body to be replaced with the unsubscribe link and message</param>
- void EnableUnsubscribe(String replace);
-
- /// <summary>
- /// Attaches a message at the footer of the email
- /// </summary>
- /// <param name="text">Message for the plain text body of the email</param>
- /// <param name="html">Message for the HTML body of the email</param>
- void EnableFooter(String text = null, String html = null);
-
- /// <summary>
- /// Re-writes links to integrate with Google Analytics
- /// </summary>
- /// <param name="source">Name of the referrer source (e.g. Google, SomeDomain.com, NewsletterA)</param>
- /// <param name="medium">Name of the marketing medium (e.g. Email)</param>
- /// <param name="term">Identify paid keywords</param>
- /// <param name="content">Use to differentiate ads</param>
- /// <param name="campaign">Name of the campaign</param>
- void EnableGoogleAnalytics(String source, String medium, String term, String content = null, String campaign = null);
-
- /// <summary>
- /// Wraps an HTML template around your email content.
- /// </summary>
- /// <param name="html">HTML that your emails will be wrapped in, containing a body replacementTag.</param>
- void EnableTemplate(String html = null);
-
- /// <summary>
- /// Enable a Template Engine template via the template ID
- /// </summary>
- /// <param name="template_id">The ID of the Template Engine template to use.</param>
- void EnableTemplateEngine(String templateId);
-
- /// <summary>
- /// Automatically sends a blind carbon copy to an address for every e-mail sent, without
- /// adding that address to the header.
- /// </summary>
- /// <param name="email">A single email recipient</param>
- void EnableBcc(String email = null);
-
- /// <summary>
- /// Enabing this app will bypass the normal unsubscribe / bounce / spam report checks
- /// and queue the e-mail for delivery.
- /// </summary>
- void EnableBypassListManagement();
-
- #endregion
- }
-} \ No newline at end of file
diff --git a/SendGrid/SendGridMail/Mail.csproj b/SendGrid/SendGridMail/Mail.csproj
deleted file mode 100644
index 85ee4a3..0000000
--- a/SendGrid/SendGridMail/Mail.csproj
+++ /dev/null
@@ -1,154 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
- <PropertyGroup Condition="'$(Configuration)' == 'Debug'">
- <SignAssembly>false</SignAssembly>
- <TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
- <DebugType>pdbonly</DebugType>
- <OutputPath>bin\Debug\</OutputPath>
- <DefineConstants>TRACE, DEBUG</DefineConstants>
- <ErrorReport>prompt</ErrorReport>
- <WarningLevel>4</WarningLevel>
- <RestorePackages>true</RestorePackages>
- <Prefer32Bit>false</Prefer32Bit>
- <BuildPackage>false</BuildPackage>
- <SignAssembly>false</SignAssembly>
- </PropertyGroup>
- <PropertyGroup Condition="'$(Configuration)' == 'BuildNet45'">
- <SignAssembly>false</SignAssembly>
- <TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
- <DebugType>pdbonly</DebugType>
- <OutputPath>bin\BuildNet45\</OutputPath>
- <DefineConstants>TRACE, BUILD</DefineConstants>
- <ErrorReport>prompt</ErrorReport>
- <WarningLevel>4</WarningLevel>
- <RestorePackages>true</RestorePackages>
- <Prefer32Bit>false</Prefer32Bit>
- <BuildPackage>false</BuildPackage>
- <SignAssembly>false</SignAssembly>
- </PropertyGroup>
- <PropertyGroup Condition="'$(Configuration)' == 'Release'">
- <SignAssembly>true</SignAssembly>
- <AssemblyOriginatorKeyFile>sendgrid-csharp.snk</AssemblyOriginatorKeyFile>
- <TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
- <DebugType>pdbonly</DebugType>
- <Optimize>True</Optimize>
- <OutputPath>bin\Release\</OutputPath>
- <DefineConstants>TRACE</DefineConstants>
- <ErrorReport>prompt</ErrorReport>
- <WarningLevel>4</WarningLevel>
- <Prefer32Bit>false</Prefer32Bit>
- </PropertyGroup>
- <PropertyGroup>
- <ProjectGuid>{3C687BEF-FF50-44AD-8315-2D4237281AF8}</ProjectGuid>
- <PublishUrl>publish\</PublishUrl>
- <Install>true</Install>
- <InstallFrom>Disk</InstallFrom>
- <UpdateEnabled>false</UpdateEnabled>
- <UpdateMode>Foreground</UpdateMode>
- <UpdateInterval>7</UpdateInterval>
- <UpdateIntervalUnits>Days</UpdateIntervalUnits>
- <UpdatePeriodically>false</UpdatePeriodically>
- <UpdateRequired>false</UpdateRequired>
- <MapFileExtensions>true</MapFileExtensions>
- <ApplicationRevision>0</ApplicationRevision>
- <ApplicationVersion>1.0.0.%2a</ApplicationVersion>
- <IsWebBootstrapper>false</IsWebBootstrapper>
- <UseApplicationTrust>false</UseApplicationTrust>
- <BootstrapperEnabled>true</BootstrapperEnabled>
- <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\</SolutionDir>
- <RestorePackages>true</RestorePackages>
- <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
- <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
- <TargetFrameworkProfile />
- <TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
- </PropertyGroup>
- <PropertyGroup>
- <OutputType>Library</OutputType>
- </PropertyGroup>
- <PropertyGroup>
- <AssemblyName>SendGridMail</AssemblyName>
- </PropertyGroup>
- <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
- <AssemblyOriginatorKeyFile>sendgrid-csharp.snk</AssemblyOriginatorKeyFile>
- <SignAssembly>true</SignAssembly>
- <DefineConstants>TRACE, RELEASE</DefineConstants>
- <DebugType>
- </DebugType>
- <Prefer32Bit>false</Prefer32Bit>
- </PropertyGroup>
- <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'BuildNet45|AnyCPU' ">
- <Optimize>false</Optimize>
- <SignAssembly>false</SignAssembly>
- <DebugType>
- </DebugType>
- <Prefer32Bit>false</Prefer32Bit>
- </PropertyGroup>
- <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|AnyCPU'">
- <SignAssembly>false</SignAssembly>
- <Optimize>false</Optimize>
- <DebugType>
- </DebugType>
- <Prefer32Bit>false</Prefer32Bit>
- </PropertyGroup>
- <PropertyGroup>
- <SignAssembly>true</SignAssembly>
- </PropertyGroup>
- <PropertyGroup>
- <AssemblyOriginatorKeyFile>sendgrid-csharp.snk</AssemblyOriginatorKeyFile>
- </PropertyGroup>
- <ItemGroup>
- <Reference Include="SendGrid.SmtpApi, Version=1.3.1.0, Culture=neutral, PublicKeyToken=2ae73662c35d80e4, processorArchitecture=MSIL">
- <SpecificVersion>False</SpecificVersion>
- <HintPath>..\packages\SendGrid.SmtpApi.1.3.1\lib\net40\SendGrid.SmtpApi.dll</HintPath>
- </Reference>
- <Reference Include="System" />
- <Reference Include="System.Net" />
- <Reference Include="System.Net.Http" />
- <Reference Include="System.Xml" />
- </ItemGroup>
- <ItemGroup>
- <Compile Include="Exceptions\InvalidApiRequestException.cs" />
- <Compile Include="ISendGrid.cs" />
- <Compile Include="Properties\AssemblyInfo.cs" />
- <Compile Include="SendGrid.cs" />
- <Compile Include="Transport\ErrorChecker.cs" />
- <Compile Include="Transport\ITransport.cs" />
- <Compile Include="Transport\Web.cs" />
- </ItemGroup>
- <ItemGroup>
- <None Include="packages.config" />
- <None Include="sendgrid-csharp.snk" />
- </ItemGroup>
- <ItemGroup>
- <BootstrapperPackage Include=".NETFramework,Version=v4.0">
- <Visible>False</Visible>
- <ProductName>Microsoft .NET Framework 4 %28x86 and x64%29</ProductName>
- <Install>true</Install>
- </BootstrapperPackage>
- <BootstrapperPackage Include="Microsoft.Net.Client.3.5">
- <Visible>False</Visible>
- <ProductName>.NET Framework 3.5 SP1 Client Profile</ProductName>
- <Install>false</Install>
- </BootstrapperPackage>
- <BootstrapperPackage Include="Microsoft.Net.Framework.3.5.SP1">
- <Visible>False</Visible>
- <ProductName>.NET Framework 3.5 SP1</ProductName>
- <Install>false</Install>
- </BootstrapperPackage>
- <BootstrapperPackage Include="Microsoft.Windows.Installer.4.5">
- <Visible>False</Visible>
- <ProductName>Windows Installer 4.5</ProductName>
- <Install>true</Install>
- </BootstrapperPackage>
- </ItemGroup>
- <ItemGroup />
- <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
- <Import Project="$(SolutionDir)\.nuget\NuGet.targets" Condition="Exists('$(SolutionDir)\.nuget\NuGet.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> \ No newline at end of file
diff --git a/SendGrid/SendGridMail/Properties/AssemblyInfo.cs b/SendGrid/SendGridMail/Properties/AssemblyInfo.cs
deleted file mode 100644
index 540b5e9..0000000
--- a/SendGrid/SendGridMail/Properties/AssemblyInfo.cs
+++ /dev/null
@@ -1,62 +0,0 @@
-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("SendGridMail")]
-[assembly: AssemblyDescription("A client library for interfacing with the SendGridMessage API")]
-[assembly: AssemblyConfiguration("")]
-[assembly: AssemblyCompany("SendGridMessage")]
-[assembly: AssemblyProduct("SendGridMail")]
-[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("193fa200-8430-4206-aacd-2d2bb2dfa6cf")]
-
-#if (BUILD)
-[assembly: InternalsVisibleTo("Tests," + "" +
- "PublicKey=0024000004800000940000000602000000240000525341310004000001000100812ec26a66c8e0" +
- "8c790704ac4b46bcc9da9f4bca4da0ec7c06ce6dcd73baeb2c5525f36a237b253e80e16febb4c0" +
- "52f50734d5e1cf3bf478d9c88f0f69df53b47306419182983bc35c33c3bafb5e90b9bd7aa7b9a9" +
- "da09abe3667d50db891012e077e4b9aefe9799a58222fa67127c230219755d7670073c7463d90c" +
- "f9e79dba")]
-#elif (DEBUG)
-[assembly: InternalsVisibleTo("Tests," + "" +
- "PublicKey=0024000004800000940000000602000000240000525341310004000001000100812ec26a66c8e0" +
- "8c790704ac4b46bcc9da9f4bca4da0ec7c06ce6dcd73baeb2c5525f36a237b253e80e16febb4c0" +
- "52f50734d5e1cf3bf478d9c88f0f69df53b47306419182983bc35c33c3bafb5e90b9bd7aa7b9a9" +
- "da09abe3667d50db891012e077e4b9aefe9799a58222fa67127c230219755d7670073c7463d90c" +
- "f9e79dba")]
-#else
-[assembly: InternalsVisibleTo("Tests," + "" +
- "PublicKey=0024000004800000940000000602000000240000525341310004000001000100812ec26a66c8e0" +
- "8c790704ac4b46bcc9da9f4bca4da0ec7c06ce6dcd73baeb2c5525f36a237b253e80e16febb4c0" +
- "52f50734d5e1cf3bf478d9c88f0f69df53b47306419182983bc35c33c3bafb5e90b9bd7aa7b9a9" +
- "da09abe3667d50db891012e077e4b9aefe9799a58222fa67127c230219755d7670073c7463d90c" +
- "f9e79dba")]
-#endif
-// 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("6.3.4")]
-[assembly: AssemblyFileVersion("6.3.4")] \ No newline at end of file
diff --git a/SendGrid/SendGridMail/SendGrid.cs b/SendGrid/SendGridMail/SendGrid.cs
deleted file mode 100644
index 1581f40..0000000
--- a/SendGrid/SendGridMail/SendGrid.cs
+++ /dev/null
@@ -1,550 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Globalization;
-using System.IO;
-using System.Linq;
-using System.Net.Mail;
-using System.Net.Mime;
-using System.Text.RegularExpressions;
-using SendGrid.SmtpApi;
-
-namespace SendGrid
-{
- public class SendGridMessage : ISendGrid
- {
- #region constants/vars
-
- //apps list and settings
- private static readonly Dictionary<String, String> Filters = InitializeFilters();
- private readonly MailMessage _message;
- private static readonly Regex TemplateTest = new Regex(@"<%\s*body\s*%>", RegexOptions.Compiled | RegexOptions.IgnoreCase);
- private static readonly Regex TextUnsubscribeTest = new Regex(@"<%\s*%>", RegexOptions.Compiled);
- private static readonly Regex HtmlUnsubscribeTest = new Regex(@"<%\s*([^\s%]+\s?)+\s*%>", RegexOptions.Compiled);
- private const string SinkHost = "sink.sendgrid.net";
-
- #endregion
-
- #region Initialization and Constructors
-
- /// <summary>
- /// Creates an instance of SendGrid's custom message object
- /// </summary>
- /// <returns></returns>
- public SendGridMessage() : this(new Header())
- {
-
- }
-
- public SendGridMessage(IHeader header)
- {
- _message = new MailMessage();
- Header = header;
- Headers = new Dictionary<string, string>();
- }
-
- public SendGridMessage(MailAddress from, MailAddress[] to,
- String subject, String html, String text, IHeader header = null) : this()
- {
- From = from;
- To = to;
-
- _message.Subject = subject;
-
- Text = text;
- Html = html;
- }
-
- private static Dictionary<string, string> InitializeFilters()
- {
- return
- new Dictionary<string, string>
- {
- {"Gravatar", "gravatar"},
- {"OpenTracking", "opentrack"},
- {"ClickTracking", "clicktrack"},
- {"SpamCheck", "spamcheck"},
- {"Unsubscribe", "subscriptiontrack"},
- {"Footer", "footer"},
- {"GoogleAnalytics", "ganalytics"},
- {"Template", "template"},
- {"Templates","templates"},
- {"Bcc", "bcc"},
- {"BypassListManagement", "bypass_list_management"}
- };
- }
-
- #endregion
-
- #region Properties
-
- public MailAddress From
- {
- get { return _message.From; }
- set { if (value != null) _message.From = value; }
- }
-
- public MailAddress[] ReplyTo
- {
- get { return _message.ReplyToList.ToArray(); }
- set
- {
- _message.ReplyToList.Clear();
- foreach (var replyTo in value)
- {
- _message.ReplyToList.Add(replyTo);
- }
- }
- }
-
- public MailAddress[] To
- {
- get
- {
- if (_sendToSink)
- {
- return _message.To
- .Select(ma => new MailAddress(string.Format("{0}_at_{1}@{2}", ma.User, ma.Host, SinkHost), ma.DisplayName))
- .ToArray();
- }
- return _message.To.ToArray();
- }
- set
- {
- _message.To.Clear();
- foreach (var mailAddress in value)
- {
- _message.To.Add(mailAddress);
- }
- }
- }
-
- public MailAddress[] Cc
- {
- get { return _message.CC.ToArray(); }
- set
- {
- _message.CC.Clear();
- foreach (var mailAddress in value)
- {
- _message.CC.Add(mailAddress);
- }
- }
- }
-
- public MailAddress[] Bcc
- {
- get { return _message.Bcc.ToArray(); }
- set
- {
- _message.Bcc.Clear();
- foreach (var mailAddress in value)
- {
- _message.Bcc.Add(mailAddress);
- }
- }
- }
-
- public String Subject
- {
- get { return _message.Subject; }
- set { if (value != null) _message.Subject = value; }
- }
-
- public Dictionary<String, String> Headers { get; set; }
- public IHeader Header { get; set; }
- public String Html { get; set; }
- public String Text { get; set; }
-
- #endregion
-
- #region Methods for setting data
-
- private List<String> _attachments = new List<String>();
- private Dictionary<String, MemoryStream> _streamedAttachments = new Dictionary<string, MemoryStream>();
- private Dictionary<String, String> _contentImages = new Dictionary<string, string>();
- private bool _sendToSink;
-
- public void AddTo(String address)
- {
- var mailAddress = new MailAddress(address);
- _message.To.Add(mailAddress);
- }
-
- public void AddTo(IEnumerable<String> addresses)
- {
- if (addresses == null) return;
-
- foreach (var address in addresses.Where(address => address != null))
- AddTo(address);
- }
-
- public void AddTo(IDictionary<String, IDictionary<String, String>> addresssInfo)
- {
- foreach (var mailAddress in from address in addresssInfo.Keys let table = addresssInfo[address] select new MailAddress(address, table.ContainsKey("DisplayName") ? table["DisplayName"] : null))
- {
- _message.To.Add(mailAddress);
- }
- }
-
- public void AddCc(string address)
- {
- var mailAddress = new MailAddress(address);
- _message.CC.Add(mailAddress);
- }
-
- public void AddCc(MailAddress address)
- {
- _message.CC.Add(address);
- }
-
- public void AddBcc(string address)
- {
- var mailAddress = new MailAddress(address);
- _message.Bcc.Add(mailAddress);
- }
-
- public void AddBcc(MailAddress address)
- {
- _message.Bcc.Add(address);
- }
-
- public Dictionary<String, MemoryStream> StreamedAttachments
- {
- get { return _streamedAttachments; }
- set { _streamedAttachments = value; }
- }
-
- public String[] Attachments
- {
- get { return _attachments.ToArray(); }
- set { _attachments = value.ToList(); }
- }
-
- public void EmbedImage(String filename, String cid) {
- _contentImages[filename] = cid;
- }
-
- public IDictionary<string, string> GetEmbeddedImages() {
- return new Dictionary<string, string>(_contentImages);
- }
-
- public void AddSubstitution(String replacementTag, List<String> substitutionValues)
- {
- //let the system complain if they do something bad, since the function returns null
- Header.AddSubstitution(replacementTag, substitutionValues);
- }
-
- public void AddSection(String replacementTag, String sectionValue)
- {
- Header.AddSection(replacementTag, sectionValue);
- }
-
- public void AddUniqueArgs(IDictionary<String, String> identifiers)
- {
- Header.AddUniqueArgs(identifiers);
- }
-
- public void SetAsmGroupId(int id)
- {
- Header.SetAsmGroupId(id);
- }
-
- public void SetIpPool(string pool)
- {
- Header.SetIpPool(pool);
- }
-
- public void SetSendAt(DateTime sendTime)
- {
- Header.SetSendAt(sendTime);
- }
-
- public void SetSendEachAt(IEnumerable<DateTime> sendTimes)
- {
- Header.SetSendEachAt(sendTimes);
- }
-
- public void SetCategory(String category)
- {
- Header.SetCategory(category);
- }
-
- public void SetCategories(IEnumerable<string> categories)
- {
- Header.SetCategories(categories);
- }
-
- public void AddAttachment(Stream stream, String name)
- {
- var ms = new MemoryStream();
- stream.CopyTo(ms);
- ms.Seek(0, SeekOrigin.Begin);
- StreamedAttachments[name] = ms;
- }
-
- public void EmbedStreamImage(Stream stream, String name)
- {
- var ms = new MemoryStream();
- stream.CopyTo(ms);
- ms.Seek(0, SeekOrigin.Begin);
- StreamedAttachments[name] = ms;
-
- _contentImages[name] = name;
- }
-
- public void AddAttachment(String filePath)
- {
- _attachments.Add(filePath);
- }
-
- public IEnumerable<String> GetRecipients()
- {
- var tos = _message.To.ToList();
- var ccs = _message.CC.ToList();
- var bccs = _message.Bcc.ToList();
-
- var rcpts = tos.Union(ccs.Union(bccs)).Select(address => address.Address);
- return rcpts;
- }
-
- public void AddHeaders(IDictionary<string, string> headers)
- {
- headers.Keys.ToList().ForEach(key => Headers[key] = headers[key]);
- }
-
- public void SendToSink(bool value = true)
- {
- _sendToSink = value;
- }
-
- #endregion
-
- #region SMTP API Functions
-
- public void DisableGravatar()
- {
- Header.DisableFilter(Filters["Gravatar"]);
- }
-
- public void DisableOpenTracking()
- {
- Header.DisableFilter(Filters["OpenTracking"]);
- }
-
- public void DisableClickTracking()
- {
- Header.DisableFilter(Filters["ClickTracking"]);
- }
-
- public void DisableSpamCheck()
- {
- Header.DisableFilter(Filters["SpamCheck"]);
- }
-
- public void DisableUnsubscribe()
- {
- Header.DisableFilter(Filters["Unsubscribe"]);
- }
-
- public void DisableFooter()
- {
- Header.DisableFilter(Filters["Footer"]);
- }
-
- public void DisableGoogleAnalytics()
- {
- Header.DisableFilter(Filters["GoogleAnalytics"]);
- }
-
- public void DisableTemplate()
- {
- Header.DisableFilter(Filters["Template"]);
- }
-
- public void DisableBcc()
- {
- Header.DisableFilter(Filters["Bcc"]);
- }
-
- public void DisableBypassListManagement()
- {
- Header.DisableFilter(Filters["BypassListManagement"]);
- }
-
- public void EnableGravatar()
- {
- Header.EnableFilter(Filters["Gravatar"]);
- }
-
- public void EnableOpenTracking()
- {
- Header.EnableFilter(Filters["OpenTracking"]);
- }
-
- public void EnableClickTracking(bool includePlainText = false)
- {
- var filter = Filters["ClickTracking"];
-
- Header.EnableFilter(filter);
- if (includePlainText)
- {
- Header.AddFilterSetting(filter, new List<string> {"enable_text"}, "1");
- }
- }
-
- public void EnableSpamCheck(int score = 5, string url = null)
- {
- var filter = Filters["SpamCheck"];
-
- Header.EnableFilter(filter);
- Header.AddFilterSetting(filter, new List<string> {"maxscore"}, score.ToString(CultureInfo.InvariantCulture));
- Header.AddFilterSetting(filter, new List<string> {"url"}, url);
- }
-
- public void EnableUnsubscribe(string text, string html)
- {
- var filter = Filters["Unsubscribe"];
-
- if (!TextUnsubscribeTest.IsMatch(text))
- {
- throw new Exception("Missing substitution replacementTag in text");
- }
-
- if (!HtmlUnsubscribeTest.IsMatch(html))
- {
- throw new Exception("Missing substitution replacementTag in html");
- }
-
- Header.EnableFilter(filter);
- Header.AddFilterSetting(filter, new List<string> {"text/plain"}, text);
- Header.AddFilterSetting(filter, new List<string> {"text/html"}, html);
- }
-
- public void EnableUnsubscribe(string replace)
- {
- var filter = Filters["Unsubscribe"];
-
- Header.EnableFilter(filter);
- Header.AddFilterSetting(filter, new List<string> {"replace"}, replace);
- }
-
- public void EnableFooter(string text = null, string html = null)
- {
- var filter = Filters["Footer"];
-
- Header.EnableFilter(filter);
- Header.AddFilterSetting(filter, new List<string> {"text/plain"}, text);
- Header.AddFilterSetting(filter, new List<string> {"text/html"}, html);
- }
-
- public void EnableGoogleAnalytics(string source, string medium, string term, string content = null,
- string campaign = null)
- {
- var filter = Filters["GoogleAnalytics"];
-
- Header.EnableFilter(filter);
- Header.AddFilterSetting(filter, new List<string> {"utm_source"}, source);
- Header.AddFilterSetting(filter, new List<string> {"utm_medium"}, medium);
- Header.AddFilterSetting(filter, new List<string> {"utm_term"}, term);
- Header.AddFilterSetting(filter, new List<string> {"utm_content"}, content);
- Header.AddFilterSetting(filter, new List<string> {"utm_campaign"}, campaign);
- }
-
- public void EnableTemplate(string html)
- {
- var filter = Filters["Template"];
-
- if (!TemplateTest.IsMatch(html))
- {
- throw new Exception("Missing <% body %> tag in template HTML");
- }
-
- Header.EnableFilter(filter);
- Header.AddFilterSetting(filter, new List<string> {"text/html"}, html);
- }
-
- public void EnableTemplateEngine(string templateId)
- {
- var filter = Filters["Templates"];
-
- Header.EnableFilter(filter);
- Header.AddFilterSetting(filter, new List<string> { "template_id" }, templateId);
- }
-
- public void EnableBcc(string email)
- {
- var filter = Filters["Bcc"];
-
- Header.EnableFilter(filter);
- Header.AddFilterSetting(filter, new List<string> {"email"}, email);
- }
-
- public void EnableBypassListManagement()
- {
- Header.EnableFilter(Filters["BypassListManagement"]);
- }
-
- #endregion
-
- public MailMessage CreateMimeMessage()
- {
- var smtpapi = Header.JsonString();
-
- if (!String.IsNullOrEmpty(smtpapi))
- _message.Headers.Add("X-Smtpapi", smtpapi);
-
- Headers.Keys.ToList().ForEach(k => _message.Headers.Add(k, Headers[k]));
-
- _message.Attachments.Clear();
- _message.AlternateViews.Clear();
-
- if (Attachments != null)
- {
- foreach (var attachment in Attachments)
- {
- _message.Attachments.Add(new Attachment(attachment, MediaTypeNames.Application.Octet));
- }
- }
-
- if (StreamedAttachments != null)
- {
- foreach (var attachment in StreamedAttachments)
- {
- attachment.Value.Position = 0;
- _message.Attachments.Add(new Attachment(attachment.Value, attachment.Key));
- }
- }
-
- if (Text != null)
- {
- var plainView = AlternateView.CreateAlternateViewFromString(Text, null, "text/plain");
- _message.AlternateViews.Add(plainView);
- }
-
- if (Html == null) return _message;
-
- var htmlView = AlternateView.CreateAlternateViewFromString(Html, null, "text/html");
- _message.AlternateViews.Add(htmlView);
-
- //message.SubjectEncoding = Encoding.GetEncoding(charset);
- //message.BodyEncoding = Encoding.GetEncoding(charset);
-
- return _message;
- }
-
- /// <summary>
- /// Helper function lets us look at the mime before it is sent
- /// </summary>
- /// <param name="directory">directory in which we store this mime message</param>
- internal void SaveMessage(String directory)
- {
- var client = new SmtpClient("localhost")
- {
- DeliveryMethod = SmtpDeliveryMethod.SpecifiedPickupDirectory,
- PickupDirectoryLocation = @"C:\temp"
- };
- var msg = CreateMimeMessage();
- client.Send(msg);
- }
- }
-} \ No newline at end of file
diff --git a/SendGrid/SendGridMail/SendGridMail.pfx b/SendGrid/SendGridMail/SendGridMail.pfx
deleted file mode 100644
index 867e499..0000000
--- a/SendGrid/SendGridMail/SendGridMail.pfx
+++ /dev/null
Binary files differ
diff --git a/SendGrid/SendGridMail/StreamedFileBody.cs b/SendGrid/SendGridMail/StreamedFileBody.cs
deleted file mode 100644
index 125fe24..0000000
--- a/SendGrid/SendGridMail/StreamedFileBody.cs
+++ /dev/null
@@ -1,39 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.IO;
-using System.Linq;
-using System.Text;
-
-namespace SendGridMail
-{
- public class StreamedFileBody
- {
- private string _name;
- private string _filename;
- private byte[] _content;
-
- public StreamedFileBody(MemoryStream stream, String name)
- {
- if (stream == null) throw new ArgumentException("Invalid attachment stream");
- if (String.IsNullOrEmpty(name)) throw new ArgumentException("Invalid attachment name");
-
- _name = "files[" + Path.GetFileName(name) + "]";
- _filename = name;
- _content = stream.ToArray();
- }
-
- public byte[] GetContent(string boundry)
- {
- var bytes = new List<byte>();
-
- string paramBoundry = "--" + boundry + "\r\n";
- string stringParam = "Content-Disposition: form-data; name=\"" + _name + "\"; filename=\"" + _filename + "\"\r\n";
- string paramEnd = "Content-Type: image/png\r\n\r\n";
-
- bytes.AddRange(Encoding.ASCII.GetBytes(paramBoundry + stringParam + paramEnd));
- bytes.AddRange(_content);
- bytes.AddRange(Encoding.ASCII.GetBytes("\r\n"));
- return bytes.ToArray();
- }
- }
-}
diff --git a/SendGrid/SendGridMail/Transport/ErrorChecker.cs b/SendGrid/SendGridMail/Transport/ErrorChecker.cs
deleted file mode 100644
index 035d2b8..0000000
--- a/SendGrid/SendGridMail/Transport/ErrorChecker.cs
+++ /dev/null
@@ -1,57 +0,0 @@
-namespace SendGrid
-{
- using System;
- using System.IO;
- using System.Net;
- using System.Net.Http;
- using System.Threading.Tasks;
- using System.Xml;
-
- using Exceptions;
-
- public static class ErrorChecker
- {
- public static void CheckForErrors(HttpResponseMessage response)
- {
- CheckForErrors(response, response.Content.ReadAsStreamAsync().Result);
- }
-
- public static async Task CheckForErrorsAsync(HttpResponseMessage response)
- {
- CheckForErrors(response, await response.Content.ReadAsStreamAsync());
- }
-
- private static void CheckForErrors(HttpResponseMessage response, Stream stream)
- {
- if (response.StatusCode != HttpStatusCode.OK)
- {
- using (var reader = XmlReader.Create(stream))
- {
- while (reader.Read())
- {
- if (!reader.IsStartElement())
- {
- continue;
- }
-
- switch (reader.Name)
- {
- case "result":
- continue;
- case "message":
- continue;
- case "errors":
- reader.ReadToFollowing("error");
- var message = reader.ReadElementContentAsString("error", reader.NamespaceURI);
- throw new InvalidApiRequestException(response.StatusCode, new[] { message }, response.ReasonPhrase);
- case "error":
- throw new ProtocolViolationException();
- default:
- throw new ArgumentException("Unknown element: " + reader.Name);
- }
- }
- }
- }
- }
- }
-} \ No newline at end of file
diff --git a/SendGrid/SendGridMail/Transport/ITransport.cs b/SendGrid/SendGridMail/Transport/ITransport.cs
deleted file mode 100644
index 94a2d7f..0000000
--- a/SendGrid/SendGridMail/Transport/ITransport.cs
+++ /dev/null
@@ -1,18 +0,0 @@
-using System.Threading.Tasks;
-
-
-namespace SendGrid
-{
- /// <summary>
- /// Encapsulates the transport mechanism so that it can be used in a generic way,
- /// regardless of the transport type
- /// </summary>
- public interface ITransport
- {
- /// <summary>
- /// Asynchronously delivers a message using the protocol of the derived class
- /// </summary>
- /// <param name="message">the message to be delivered</param>
- Task DeliverAsync(ISendGrid message);
- }
-} \ No newline at end of file
diff --git a/SendGrid/SendGridMail/Transport/Web.cs b/SendGrid/SendGridMail/Transport/Web.cs
deleted file mode 100644
index dbf5d28..0000000
--- a/SendGrid/SendGridMail/Transport/Web.cs
+++ /dev/null
@@ -1,186 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.IO;
-using System.Linq;
-using System.Net;
-using System.Net.Http;
-using System.Net.Http.Headers;
-using System.Reflection;
-using System.Threading.Tasks;
-using SendGrid.SmtpApi;
-
-// ReSharper disable MemberCanBePrivate.Global
-namespace SendGrid
-{
- public class Web : ITransport
- {
- #region Properties
-
- //TODO: Make this configurable
- public const String Endpoint = "https://api.sendgrid.com/api/mail.send.xml";
- private readonly NetworkCredential _credentials;
- private readonly HttpClient _client;
- private readonly string _apiKey;
-
- #endregion
-
- /// <summary>
- /// Creates a new Web interface for sending mail
- /// </summary>
- /// <param name="apiKey">The API Key with which to send</param>
- public Web(string apiKey)
- : this(apiKey, null, TimeSpan.FromSeconds(100)) { }
-
- /// <summary>
- /// Creates a new Web interface for sending mail
- /// </summary>
- /// <param name="credentials">SendGridMessage user parameters</param>
- public Web(NetworkCredential credentials)
- : this(null, credentials, TimeSpan.FromSeconds(100)) { }
-
- /// <summary>
- /// Creates a new Web interface for sending mail.
- /// </summary>
- /// <param name="apKey">The API Key with which to send</param>
- /// <param name="credentials">SendGridMessage user parameters</param>
- /// <param name="httpTimeout">HTTP request timeout</param>
- public Web(string apiKey, NetworkCredential credentials, TimeSpan httpTimeout)
- {
- _credentials = credentials;
- _client = new HttpClient();
- _apiKey = apiKey;
-
- var version = Assembly.GetExecutingAssembly().GetName().Version.ToString();
- if (credentials == null)
- {
- _client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", _apiKey);
- }
- _client.DefaultRequestHeaders.TryAddWithoutValidation("User-Agent", "sendgrid/" + version + ";csharp");
- _client.Timeout = httpTimeout;
- }
-
- /// <summary>
- /// Asynchronously delivers a message over SendGrid's Web interface
- /// </summary>
- /// <param name="message"></param>
- public async Task DeliverAsync(ISendGrid message)
- {
- var content = new MultipartFormDataContent();
- AttachFormParams(message, content);
- AttachFiles(message, content);
- var response = await _client.PostAsync(Endpoint, content);
- await ErrorChecker.CheckForErrorsAsync(response);
- }
-
- #region Support Methods
-
- private void AttachFormParams(ISendGrid message, MultipartFormDataContent content)
- {
- var formParams = FetchFormParams(message);
- foreach (var keyValuePair in formParams)
- {
- content.Add(new StringContent(keyValuePair.Value), keyValuePair.Key);
- }
- }
-
- private void AttachFiles(ISendGrid message, MultipartFormDataContent content)
- {
- var files = FetchFileBodies(message);
- foreach (var file in files)
- {
- var fs = new FileStream(file.Key, FileMode.Open, FileAccess.Read);
- var fileContent = new StreamContent(fs);
-
- fileContent.Headers.ContentDisposition = new ContentDispositionHeaderValue("form-data")
- {
- Name = "files[" + Path.GetFileName(file.Key) + "]",
- FileName = Path.GetFileName(file.Key)
- };
-
- fileContent.Headers.ContentType = MediaTypeHeaderValue.Parse("application/octet-stream");
- content.Add(fileContent);
- }
-
- var streamingFiles = FetchStreamingFileBodies(message);
- foreach (var file in streamingFiles)
- {
- var stream = file.Value;
- var fileContent = new StreamContent(stream);
-
- fileContent.Headers.ContentDisposition = new ContentDispositionHeaderValue("form-data")
- {
- Name = "files[" + Path.GetFileName(file.Key) + "]",
- FileName = Path.GetFileName(file.Key)
- };
-
- fileContent.Headers.ContentType = MediaTypeHeaderValue.Parse("application/octet-stream");
- content.Add(fileContent);
- }
- }
-
- internal List<KeyValuePair<String, String>> FetchFormParams(ISendGrid message)
- {
- var result = new List<KeyValuePair<string, string>>
- {
- new KeyValuePair<String, String>("headers",
- message.Headers.Count == 0 ? null : Utils.SerializeDictionary(message.Headers)),
- new KeyValuePair<String, String>("replyto",
- message.ReplyTo.Length == 0 ? null : message.ReplyTo.ToList().First().Address),
- new KeyValuePair<String, String>("from", message.From.Address),
- new KeyValuePair<String, String>("fromname", message.From.DisplayName),
- new KeyValuePair<String, String>("subject", message.Subject),
- new KeyValuePair<String, String>("text", message.Text),
- new KeyValuePair<String, String>("html", message.Html),
- new KeyValuePair<String, String>("x-smtpapi", message.Header.JsonString() ?? "")
- };
-
- //If the API key is not specified, use the username and password
- if (_credentials != null)
- {
- var creds = new List<KeyValuePair<string, string>>
- {
- new KeyValuePair<string, string>("api_user", _credentials.UserName),
- new KeyValuePair<string, string>("api_key", _credentials.Password)
- };
- result.AddRange(creds);
- }
-
- if (message.To != null)
- {
- result = result.Concat(message.To.ToList().Select(a => new KeyValuePair<String, String>("to[]", a.Address)))
- .Concat(message.To.ToList().Select(a => new KeyValuePair<String, String>("toname[]", a.DisplayName)))
- .ToList();
- }
-
- if (message.Cc != null)
- {
- result.AddRange(message.Cc.Select(c => new KeyValuePair<string, string>("cc[]", c.Address)));
- }
-
- if (message.Bcc != null)
- {
- result.AddRange(message.Bcc.Select(c => new KeyValuePair<string, string>("bcc[]", c.Address)));
- }
-
- if (message.GetEmbeddedImages().Count > 0) {
- result = result.Concat(message.GetEmbeddedImages().ToList().Select(x => new KeyValuePair<String, String>(string.Format("content[{0}]", x.Key), x.Value)))
- .ToList();
- }
- return result.Where(r => !String.IsNullOrEmpty(r.Value)).ToList();
- }
-
- internal IEnumerable<KeyValuePair<string, MemoryStream>> FetchStreamingFileBodies(ISendGrid message)
- {
- return message.StreamedAttachments.Select(kvp => kvp).ToList();
- }
-
- internal List<KeyValuePair<String, FileInfo>> FetchFileBodies(ISendGrid message)
- {
- return message.Attachments == null
- ? new List<KeyValuePair<string, FileInfo>>()
- : message.Attachments.Select(name => new KeyValuePair<String, FileInfo>(name, new FileInfo(name))).ToList();
- }
-
- #endregion
- }
-}
diff --git a/SendGrid/SendGridMail/Web/IWebApi.cs b/SendGrid/SendGridMail/Web/IWebApi.cs
deleted file mode 100644
index 52d4cb2..0000000
--- a/SendGrid/SendGridMail/Web/IWebApi.cs
+++ /dev/null
@@ -1,45 +0,0 @@
-using System;
-using System.Collections.Generic;
-
-namespace SendGridMail.Web
-{
- interface IWebApi
- {
- String user { get; set; }
- String pass { get; set; }
-
- String GetBounces(int date, String days, DateTime start_date, DateTime end_date, int limit, int offset, int type, String email);
- void DeleteBounces(DateTime start_date, DateTime end_date, String type, String email);
- String GetBlocks(int days, DateTime start_date, DateTime end_date, String email);
- void DeleteBlocks(String email);
- String GetEmailParse(String hostname, String url);
- void SetEmailParse(String hostname, String url);
- void EditEmailParse(String hostname, String url);
- void DeleteEmailParse(String hostname);
- String GetNotificationUrl();
- void SetNotificationUrl(String url);
- void DeleteNotificationUrl();
- String GetFilter();
- void ActivateFilter(String name);
- void DeactivateFilter(String name);
- void SetupFilter(String user, String password, Dictionary<String, String> args);
- String GetFilterSettings(String name);
- void GetInvalidEmails(int date, int days, DateTime start_date, DateTime end_date, int limit, int offset, String email);
- void DeleteInvalidEmails(DateTime start_date, DateTime end_date, String email);
- String CountInvalidEmails(DateTime start_date, DateTime end_date);
- String GetProfile();
- void UpdateProfile(String First_name, String last_name, String address, String city, String state, String country, int zip, int phone, String website);
- void SetUsername(String username);
- void SetPassword(String password, String confpass);
- void SetEmail(String email);
- String GetSpamReports(int date, int days, DateTime start_date, DateTime end_date, int limit, int offset, String email);
- void DeleteSpamReports(DateTime start_date, DateTime end_date, String email);
- String GetStats(int days, DateTime start_date, DateTime end_date);
- String GetAggregateStats();
- String GetCategoryStats();
- String GetCategoryStats(String category, int days, DateTime start_date, DateTime end_date);
- String GetUnsubscribes(int date, int days, DateTime start_date, DateTime end_date, int limit, int offset, String email);
- void DeleteUnsubscribes(DateTime start_date, DateTime end_date, String email);
- void AddUnsubscribes(String email);
- }
-}
diff --git a/SendGrid/SendGridMail/app.config b/SendGrid/SendGridMail/app.config
deleted file mode 100644
index 67113e6..0000000
--- a/SendGrid/SendGridMail/app.config
+++ /dev/null
@@ -1,3 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<configuration>
-</configuration> \ No newline at end of file
diff --git a/SendGrid/SendGridMail/nuget/Sendgrid.2.1.1.nuspec b/SendGrid/SendGridMail/nuget/Sendgrid.2.1.1.nuspec
deleted file mode 100644
index a6cc5f9..0000000
--- a/SendGrid/SendGridMail/nuget/Sendgrid.2.1.1.nuspec
+++ /dev/null
@@ -1,24 +0,0 @@
-<?xml version="1.0"?>
-<package xmlns="http://schemas.microsoft.com/packaging/2011/08/nuspec.xsd">
- <metadata>
- <id>Sendgrid</id>
- <version>2.1.1</version>
- <title>SendGrid</title>
- <authors>CJ Buchmann, Tyler Bischel, Eric Becking, Brandon West</authors>
- <owners>CJ Buchmann, Tyler Bischel, Eric Becking, Brandon West</owners>
- <licenseUrl>https://github.com/sendgrid/sendgrid-csharp/blob/master/MIT.LICENSE</licenseUrl>
- <projectUrl>https://github.com/sendgrid/sendgrid-csharp</projectUrl>
- <requireLicenseAcceptance>false</requireLicenseAcceptance>
- <description>Basic C# client library and examples for using SendGrid API's to send mail. Github repo located at : https://github.com/sendgrid/sendgrid-csharp</description>
- <releaseNotes>BREAKING CHANGE: Deprecates SMTP transport and adds dependency on smtpapi package for building headers.
-
-For an example of how to continue using SMTP, see https://github.com/sendgrid/smtpapi-csharp</releaseNotes>
- <copyright>Copyright 2014</copyright>
- <tags>SendGrid Email Mail Microsoft Azure</tags>
- <dependencies>
- <dependency id="Microsoft.Net.Http" version="2.2.13" />
- <dependency id="Microsoft.Bcl.Async" version="1.0.16" />
- <dependency id="smtpapi" version="1.0.0" />
- </dependencies>
- </metadata>
-</package> \ No newline at end of file
diff --git a/SendGrid/SendGridMail/nuget/lib/SendGridMail.dll b/SendGrid/SendGridMail/nuget/lib/SendGridMail.dll
deleted file mode 100644
index 47d8c95..0000000
--- a/SendGrid/SendGridMail/nuget/lib/SendGridMail.dll
+++ /dev/null
Binary files differ
diff --git a/SendGrid/SendGridMail/packages.config b/SendGrid/SendGridMail/packages.config
deleted file mode 100644
index 030933b..0000000
--- a/SendGrid/SendGridMail/packages.config
+++ /dev/null
@@ -1,4 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<packages>
- <package id="SendGrid.SmtpApi" version="1.3.1" targetFramework="net45" />
-</packages> \ No newline at end of file
diff --git a/SendGrid/SendGridMail/sendgrid-csharp.snk b/SendGrid/SendGridMail/sendgrid-csharp.snk
deleted file mode 100644
index aff2944..0000000
--- a/SendGrid/SendGridMail/sendgrid-csharp.snk
+++ /dev/null
Binary files differ