diff options
author | Brandon West <brawest@gmail.com> | 2013-01-10 13:40:31 -0700 |
---|---|---|
committer | Brandon West <brawest@gmail.com> | 2013-01-10 13:40:31 -0700 |
commit | f0369817159f954f4e83e5fef1cd8ed057aa3904 (patch) | |
tree | 939d06bc5248781d60b10dea903b90e6d2a0f1b7 | |
parent | 2e51a34035a05ec7df8f05fca5a8787787a78bc6 (diff) | |
download | sendgrid-csharp-f0369817159f954f4e83e5fef1cd8ed057aa3904.zip sendgrid-csharp-f0369817159f954f4e83e5fef1cd8ed057aa3904.tar.gz sendgrid-csharp-f0369817159f954f4e83e5fef1cd8ed057aa3904.tar.bz2 |
change web.CheckForErrors to handle response from mail.send
-rw-r--r--[-rwxr-xr-x] | SendGrid/Example/Example.csproj | 24 | ||||
-rwxr-xr-x | SendGrid/Example/Program.cs | 13 | ||||
-rwxr-xr-x | SendGrid/SendGridMail/Transport/Web.cs | 6 |
3 files changed, 22 insertions, 21 deletions
diff --git a/SendGrid/Example/Example.csproj b/SendGrid/Example/Example.csproj index 1f85cc2..6527d35 100755..100644 --- a/SendGrid/Example/Example.csproj +++ b/SendGrid/Example/Example.csproj @@ -10,16 +10,13 @@ <AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>Example</RootNamespace>
<AssemblyName>Example</AssemblyName>
- <TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
- <TargetFrameworkProfile>
- </TargetFrameworkProfile>
<FileAlignment>512</FileAlignment>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x86' ">
<PlatformTarget>x86</PlatformTarget>
- <DebugSymbols>true</DebugSymbols>
+ <DebugSymbols>True</DebugSymbols>
<DebugType>full</DebugType>
- <Optimize>false</Optimize>
+ <Optimize>False</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
@@ -28,7 +25,7 @@ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x86' ">
<PlatformTarget>x86</PlatformTarget>
<DebugType>pdbonly</DebugType>
- <Optimize>true</Optimize>
+ <Optimize>True</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
@@ -43,6 +40,9 @@ <Reference Include="Microsoft.CSharp" />
<Reference Include="System.Data" />
<Reference Include="System.Xml" />
+ <Reference Include="CodeScales.Http">
+ <HintPath>..\SendGridMail\bin\Release\CodeScales.Http.dll</HintPath>
+ </Reference>
</ItemGroup>
<ItemGroup>
<Compile Include="Program.cs" />
@@ -51,12 +51,6 @@ <Compile Include="SMTPAPI.cs" />
</ItemGroup>
<ItemGroup>
- <ProjectReference Include="..\SendGridMail\Mail.csproj">
- <Project>{3C687BEF-FF50-44AD-8315-2D4237281AF8}</Project>
- <Name>Mail</Name>
- </ProjectReference>
- </ItemGroup>
- <ItemGroup>
<None Include="app.config">
<SubType>Designer</SubType>
</None>
@@ -69,4 +63,10 @@ <Target Name="AfterBuild">
</Target>
-->
+ <ItemGroup>
+ <ProjectReference Include="..\SendGridMail\Mail.csproj">
+ <Project>{3C687BEF-FF50-44AD-8315-2D4237281AF8}</Project>
+ <Name>Mail</Name>
+ </ProjectReference>
+ </ItemGroup>
</Project>
\ No newline at end of file diff --git a/SendGrid/Example/Program.cs b/SendGrid/Example/Program.cs index 1debf2e..7b83b38 100755 --- a/SendGrid/Example/Program.cs +++ b/SendGrid/Example/Program.cs @@ -15,21 +15,18 @@ namespace Example // this code is used for the SMTPAPI examples
static void Main(string[] args)
{
- var username = "sgrid_username";
- var password = "sgrid_password";
- var from = "bar@domain.com";
+ var username = "brandonmwest";
+ var password = "!!s3ndgr1d";
+ var from = "brandon.west@sendgrid.com";
var to = new List<String>
{
- "foo@domain.com",
- "raz@domain.com"
+ "@gmail.com",
};
- //initialize the SMTPAPI example class
- var smtpapi = new SMTPAPI(username, password, from, to);
var restapi = new WEBAPI(username, password, from, to);
//use this section to test out our Web and SMTP examples!
- smtpapi.SimpleHTMLEmail();
+ restapi.SimpleHTMLEmail();
Console.WriteLine("Done!");
Console.ReadLine();
diff --git a/SendGrid/SendGridMail/Transport/Web.cs b/SendGrid/SendGridMail/Transport/Web.cs index 5a27469..7015653 100755 --- a/SendGrid/SendGridMail/Transport/Web.cs +++ b/SendGrid/SendGridMail/Transport/Web.cs @@ -107,7 +107,11 @@ namespace SendGridMail.Transport case "result":
break;
case "message": // success
- return;
+ bool errors = reader.ReadToNextSibling("errors");
+ if (errors)
+ throw new ProtocolViolationException(status);
+ else
+ return;
case "error": // failure
throw new ProtocolViolationException(status);
default:
|