diff options
author | Brandon West <brawest@gmail.com> | 2014-10-09 15:04:12 -0600 |
---|---|---|
committer | Brandon West <brawest@gmail.com> | 2014-10-09 15:04:12 -0600 |
commit | 3779170bfcecbadc06a79d400cf5e2fdb070fca8 (patch) | |
tree | f931777aa363c23af8207b789379c296d4894937 | |
parent | 5155ba90dc9046039162ab97358dbffd4bf0c1bf (diff) | |
download | sendgrid-csharp-3779170bfcecbadc06a79d400cf5e2fdb070fca8.zip sendgrid-csharp-3779170bfcecbadc06a79d400cf5e2fdb070fca8.tar.gz sendgrid-csharp-3779170bfcecbadc06a79d400cf5e2fdb070fca8.tar.bz2 |
add user-agent
-rw-r--r-- | SendGrid/Example/Example.csproj | 12 | ||||
-rw-r--r-- | SendGrid/SendGridMail/Properties/AssemblyInfo.cs | 4 | ||||
-rw-r--r-- | SendGrid/SendGridMail/Transport/Web.cs | 8 |
3 files changed, 15 insertions, 9 deletions
diff --git a/SendGrid/Example/Example.csproj b/SendGrid/Example/Example.csproj index 8152179..f604aaa 100644 --- a/SendGrid/Example/Example.csproj +++ b/SendGrid/Example/Example.csproj @@ -60,6 +60,12 @@ <ItemGroup>
<WCFMetadata Include="Service References\" />
</ItemGroup>
+ <ItemGroup>
+ <ProjectReference Include="..\SendGridMail\Mail.csproj">
+ <Project>{3c687bef-ff50-44ad-8315-2d4237281af8}</Project>
+ <Name>Mail</Name>
+ </ProjectReference>
+ </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.
@@ -69,10 +75,4 @@ <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/SendGridMail/Properties/AssemblyInfo.cs b/SendGrid/SendGridMail/Properties/AssemblyInfo.cs index dbff93a..c2d2a11 100644 --- a/SendGrid/SendGridMail/Properties/AssemblyInfo.cs +++ b/SendGrid/SendGridMail/Properties/AssemblyInfo.cs @@ -48,5 +48,5 @@ using System.Runtime.InteropServices; // by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
-[assembly: AssemblyVersion("4.0.0")]
-[assembly: AssemblyFileVersion("4.0.0")]
\ No newline at end of file +[assembly: AssemblyVersion("4.1.0")]
+[assembly: AssemblyFileVersion("4.1.0")]
\ No newline at end of file diff --git a/SendGrid/SendGridMail/Transport/Web.cs b/SendGrid/SendGridMail/Transport/Web.cs index 9784097..1458da8 100644 --- a/SendGrid/SendGridMail/Transport/Web.cs +++ b/SendGrid/SendGridMail/Transport/Web.cs @@ -5,8 +5,10 @@ using System.Linq; using System.Net;
using System.Net.Http;
using System.Net.Http.Headers;
+using System.Reflection;
using System.Threading.Tasks;
using System.Xml;
+using Exceptions;
using SendGrid.SmtpApi;
// ReSharper disable MemberCanBePrivate.Global
@@ -45,7 +47,8 @@ namespace SendGrid BaseAddress = new Uri("https://" + BaseUrl)
};
- client.DefaultRequestHeaders.TryAddWithoutValidation("User-Agent", "sendgrid/4.0.1;csharp");
+ var version = Assembly.GetExecutingAssembly().GetName().Version.ToString();
+ client.DefaultRequestHeaders.TryAddWithoutValidation("User-Agent", "sendgrid/" + version + ";csharp");
var content = new MultipartFormDataContent();
AttachFormParams(message, content);
@@ -65,6 +68,9 @@ namespace SendGrid BaseAddress = new Uri("https://" + BaseUrl)
};
+ var version = Assembly.GetExecutingAssembly().GetName().Version.ToString();
+ client.DefaultRequestHeaders.TryAddWithoutValidation("User-Agent", "sendgrid/" + version + ";csharp");
+
var content = new MultipartFormDataContent();
AttachFormParams(message, content);
AttachFiles(message, content);
|