Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions .config/dotnet-tools.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"version": 1,
"isRoot": true,
"tools": {
"csharpier": {
"version": "0.18.0",
"commands": [
"dotnet-csharpier"
]
}
}
}
4 changes: 4 additions & 0 deletions .csharpierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"printWidth": 150,
"preprocessorSymbolSets": ["", "DEBUG", "DEBUG,CODE_STYLE"]
}
555 changes: 555 additions & 0 deletions .editorconfig

Large diffs are not rendered by default.

47 changes: 4 additions & 43 deletions examples/BCC/BCC.csproj
Original file line number Diff line number Diff line change
@@ -1,48 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{16978032-B34C-44B6-8DA1-475D751338F1}</ProjectGuid>
<TargetFramework>net6.0</TargetFramework>
<OutputType>Exe</OutputType>
<RootNamespace>BCC</RootNamespace>
<AssemblyName>BCC</AssemblyName>
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug</OutputPath>
<DefineConstants>DEBUG;</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<Externalconsole>true</Externalconsole>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>full</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release</OutputPath>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<Externalconsole>true</Externalconsole>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
<Reference Include="System.Configuration" />
<Reference Include="Newtonsoft.Json">
<HintPath>..\packages\Newtonsoft.Json.6.0.1\lib\net45\Newtonsoft.Json.dll</HintPath>
</Reference>
<Reference Include="SparkPost">
<HintPath>..\packages\SparkPost.1.6.2\lib\net45\SparkPost.dll</HintPath>
</Reference>
</ItemGroup>
<ItemGroup>
<Compile Include="Program.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
<ItemGroup>
<None Include="packages.config" />
<ProjectReference Include="..\..\src\SparkPost\SparkPost.csproj" />
</ItemGroup>
</Project>
</Project>
92 changes: 35 additions & 57 deletions examples/BCC/Program.cs
Original file line number Diff line number Diff line change
@@ -1,60 +1,38 @@
using System;
using System.Configuration;
using SparkPost;

namespace SparkPost.Examples
var apikey = "YOUR_API_KEY";
var fromAddr = "from-csharp@yourdomain.com";
var toAddr = "to@you.com";
var ccAddr = "cc@them.com";
var bccAddr = "bcc@sneaky.com";

var trans = new Transmission();

var to = new Recipient { Address = new Address { Email = toAddr } };
trans.Recipients.Add(to);

var cc = new Recipient
{
Address = new Address { Email = ccAddr, HeaderTo = toAddr }
};
trans.Recipients.Add(cc);

var bcc = new Recipient
{
internal class BCC
{
public static void Main(string[] args)
{
var settings = ConfigurationManager.AppSettings;
var fromAddr = settings["fromaddr"];
var toAddr = settings["toaddr"];
var ccAddr = settings["ccaddr"];
var bccAddr = settings["bccaddr"];

var trans = new Transmission();

var to = new Recipient
{
Address = new Address {Email = toAddr}
};
trans.Recipients.Add(to);

var cc = new Recipient
{
Address = new Address
{
Email = ccAddr,
HeaderTo = toAddr
}
};
trans.Recipients.Add(cc);

var bcc = new Recipient
{
Address = new Address
{
Email = bccAddr,
HeaderTo = toAddr
}
};
trans.Recipients.Add(bcc);

trans.Content.From.Email = fromAddr;
trans.Content.Subject = "SparkPost BCC / CC example";
trans.Content.Text =
"This message was sent To 1 recipient, 1 recipient was CC'd and 1 sneaky recipient was BCC'd.";
trans.Content.Headers.Add("CC", ccAddr);

Console.Write("Sending BCC / CC sample mail...");

var client = new Client(settings["apikey"]);
client.CustomSettings.SendingMode = SendingModes.Sync;

var response = client.Transmissions.Send(trans);

Console.WriteLine("done");
}
}
}
Address = new Address { Email = bccAddr, HeaderTo = toAddr }
};
trans.Recipients.Add(bcc);

trans.Content.From.Email = fromAddr;
trans.Content.Subject = "SparkPost BCC / CC example";
trans.Content.Text = "This message was sent To 1 recipient, 1 recipient was CC'd and 1 sneaky recipient was BCC'd.";
trans.Content.Headers.Add("CC", ccAddr);

Console.Write("Sending BCC / CC sample mail...");

var client = new Client(apikey);

var response = await client.Transmissions.Send(trans);

Console.WriteLine("done");
27 changes: 0 additions & 27 deletions examples/BCC/Properties/AssemblyInfo.cs

This file was deleted.

5 changes: 0 additions & 5 deletions examples/BCC/packages.config

This file was deleted.

50 changes: 4 additions & 46 deletions examples/CC/CC.csproj
Original file line number Diff line number Diff line change
@@ -1,51 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{2B086611-A56B-4857-9F7F-A8603D7AA3FD}</ProjectGuid>
<TargetFramework>net6.0</TargetFramework>
<OutputType>Exe</OutputType>
<RootNamespace>CC</RootNamespace>
<AssemblyName>CC</AssemblyName>
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug</OutputPath>
<DefineConstants>DEBUG;</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<Externalconsole>true</Externalconsole>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>full</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release</OutputPath>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<Externalconsole>true</Externalconsole>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
<Reference Include="System.Configuration" />
<Reference Include="Newtonsoft.Json">
<HintPath>..\packages\Newtonsoft.Json.6.0.1\lib\net45\Newtonsoft.Json.dll</HintPath>
</Reference>
<Reference Include="SparkPost">
<HintPath>..\packages\SparkPost.1.6.2\lib\net45\SparkPost.dll</HintPath>
</Reference>
</ItemGroup>
<ItemGroup>
<Compile Include="Program.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
<ItemGroup>
<None Include="..\app.config">
<Link>app.config</Link>
</None>
<None Include="packages.config" />
<ProjectReference Include="..\..\src\SparkPost\SparkPost.csproj" />
</ItemGroup>
</Project>
</Project>
73 changes: 28 additions & 45 deletions examples/CC/Program.cs
Original file line number Diff line number Diff line change
@@ -1,48 +1,31 @@
using System;
using System.Configuration;
using SparkPost;

namespace SparkPost.Examples
var apikey = "YOUR_API_KEY";
var fromAddr = "from-csharp@yourdomain.com";
var toAddr = "to@you.com";
var ccAddr = "cc@them.com";

var trans = new Transmission();

var to = new Recipient { Address = new Address { Email = toAddr } };
trans.Recipients.Add(to);

var cc = new Recipient
{
internal class CC
{
public static void Main(string[] args)
{
var settings = ConfigurationManager.AppSettings;
var fromAddr = settings["fromaddr"];
var toAddr = settings["toaddr"];
var ccAddr = settings["ccaddr"];

var trans = new Transmission();

var to = new Recipient
{
Address = new Address {Email = toAddr}
};
trans.Recipients.Add(to);

var cc = new Recipient
{
Address = new Address
{
Email = ccAddr,
HeaderTo = toAddr
}
};
trans.Recipients.Add(cc);

trans.Content.From.Email = fromAddr;
trans.Content.Subject = "SparkPost CC example";
trans.Content.Text = "This message was sent To 1 recipient and 1 recipient was CC'd.";
trans.Content.Headers.Add("CC", ccAddr);

Console.Write("Sending CC sample mail...");

var client = new Client(settings["apikey"]);
client.CustomSettings.SendingMode = SendingModes.Sync;

var response = client.Transmissions.Send(trans);

Console.WriteLine("done");
}
}
}
Address = new Address { Email = ccAddr, HeaderTo = toAddr }
};
trans.Recipients.Add(cc);

trans.Content.From.Email = fromAddr;
trans.Content.Subject = "SparkPost CC example";
trans.Content.Text = "This message was sent To 1 recipient and 1 recipient was CC'd.";
trans.Content.Headers.Add("CC", ccAddr);

Console.Write("Sending CC sample mail...");

var client = new Client(apikey);

var response = await client.Transmissions.Send(trans);

Console.WriteLine("done");
27 changes: 0 additions & 27 deletions examples/CC/Properties/AssemblyInfo.cs

This file was deleted.

5 changes: 0 additions & 5 deletions examples/CC/packages.config

This file was deleted.

Loading