diff --git a/appveyor.yml b/appveyor.yml
index 123de9f..5241210 100644
--- a/appveyor.yml
+++ b/appveyor.yml
@@ -25,11 +25,11 @@ environment:
WRITE_ACCOUNT_TOKEN:
secure: 8WHfQJv+ZjUJp8pd5KcG0MjOelyEskSA9c/o0QnbIIQaV5hA3BqprE2cnorsCtnR
WRITE_TEST_SERVER_TOKEN:
- secure: 4Pt2zMfFltMLSxpvud43AYFTlZWqXRurVBZgCajtzXk3hZpOV1wPPXvUPIUYcw1D
+ secure: 7b+JCrYYad3qDnzp8+ugDy2QkRI4DIhnOGgHKTaQr6bW4Po9JM8v0F2Ik6kEGN9l
WRITE_TEST_SENDER_EMAIL_ADDRESS:
secure: Ke83sTbZc/+9/mokIvL8BxtPl6yA9tyjjs5kWTI06ZNodxd5gfXpm6Ns+6l0jMLZ
WRITE_TEST_SENDER_SIGNATURE_PROTOTYPE:
- secure: dfbWIBndqE2MTj/qyJVP2I13XJlMKA64mI9/jcx1Fa1bZqPqW/tAfxeMViEMjQU836IYWflAG2h4IjARH+K+2uvhTz5y2rb9DzpLvzohKs8=
+ secure: XQWpiA4jiibMvLdkbiiCNtH2kngGoFtFsx9LWGy7Qvo91oFGx35yOQrUFOhJrvU+OhCHL01n4eCM7I8HTHkjog==
WRITE_TEST_EMAIL_RECIPIENT_ADDRESS:
secure: Ke83sTbZc/+9/mokIvL8BxtPl6yA9tyjjs5kWTI06ZNodxd5gfXpm6Ns+6l0jMLZ
WRITE_TEST_DOMAIN_NAME:
diff --git a/src/Postmark.Net20/Postmark.Net20.csproj b/src/Postmark.Net20/Postmark.Net20.csproj
index 347ea2a..6390b27 100644
--- a/src/Postmark.Net20/Postmark.Net20.csproj
+++ b/src/Postmark.Net20/Postmark.Net20.csproj
@@ -76,6 +76,9 @@
Model\InboundMessageStatus.cs
+
+ Model\LinkTrackingOptions.cs
+
Model\OutboundMessageStatus.cs
diff --git a/src/Postmark.Net35/Postmark.Net35.csproj b/src/Postmark.Net35/Postmark.Net35.csproj
index 93fd8d6..7612fff 100644
--- a/src/Postmark.Net35/Postmark.Net35.csproj
+++ b/src/Postmark.Net35/Postmark.Net35.csproj
@@ -86,6 +86,9 @@
Model\InboundMessageStatus.cs
+
+ Model\LinkTrackingOptions.cs
+
Model\OutboundMessageStatus.cs
diff --git a/src/Postmark.PCL.Tests/ClientSendingTests.cs b/src/Postmark.PCL.Tests/ClientSendingTests.cs
index 0dd7e15..a79f9e9 100644
--- a/src/Postmark.PCL.Tests/ClientSendingTests.cs
+++ b/src/Postmark.PCL.Tests/ClientSendingTests.cs
@@ -59,6 +59,7 @@ private PostmarkMessage ConstructMessage(string inboundAddress, int number = 0)
HtmlBody = String.Format("Testing the Postmark .net client, {0}", TESTING_DATE),
TextBody = "This is plain text.",
TrackOpens = true,
+ TrackLinks = LinkTrackingOptions.HtmlAndText,
Headers = new HeaderCollection(){
{ "X-Integration-Testing-Postmark-Type-Message" , TESTING_DATE.ToString("o")}
},
diff --git a/src/Postmark.PCL.Tests/ClientServerInformationTests.cs b/src/Postmark.PCL.Tests/ClientServerInformationTests.cs
index fdf4107..025ff29 100644
--- a/src/Postmark.PCL.Tests/ClientServerInformationTests.cs
+++ b/src/Postmark.PCL.Tests/ClientServerInformationTests.cs
@@ -56,7 +56,7 @@ public async void Client_CanGetEditAServerInformation()
!existingServer.RawEmailEnabled, !existingServer.SmtpApiActivated,
_inboundHookUrl + updatedAffix, _bounceHookUrl + updatedAffix,
_openHookUrl + updatedAffix, !existingServer.PostFirstOpenOnly,
- !existingServer.TrackOpens, null, 10);
+ !existingServer.TrackOpens, null, 10, LinkTrackingOptions.HtmlOnly);
//go get a fresh copy from the API.
var retrievedServer = await _client.GetServerAsync();
@@ -68,7 +68,8 @@ await _client.EditServerAsync(
existingServer.InboundHookUrl, existingServer.BounceHookUrl,
existingServer.OpenHookUrl, existingServer.PostFirstOpenOnly,
existingServer.TrackOpens, null,
- existingServer.InboundSpamThreshold);
+ existingServer.InboundSpamThreshold,
+ LinkTrackingOptions.None);
Assert.AreEqual(_name + updatedAffix, retrievedServer.Name);
Assert.AreEqual(ServerColors.Purple, retrievedServer.Color);
@@ -82,6 +83,7 @@ await _client.EditServerAsync(
Assert.AreNotEqual(existingServer.TrackOpens, retrievedServer.TrackOpens);
Assert.AreEqual(10, retrievedServer.InboundSpamThreshold);
Assert.AreNotEqual(existingServer.InboundSpamThreshold, retrievedServer.InboundSpamThreshold);
+ Assert.AreEqual(LinkTrackingOptions.HtmlOnly, retrievedServer.TrackLinks);
}
diff --git a/src/Postmark.PCL/Model/PostmarkMessage.cs b/src/Postmark.PCL/Model/PostmarkMessage.cs
index 28cfc86..e2a7132 100644
--- a/src/Postmark.PCL/Model/PostmarkMessage.cs
+++ b/src/Postmark.PCL/Model/PostmarkMessage.cs
@@ -1,10 +1,6 @@
using PostmarkDotNet.Model;
-using System;
using System.Collections.Generic;
-using System.Linq;
using System.Net;
-using System.Text;
-using System.Threading.Tasks;
namespace PostmarkDotNet
{
diff --git a/src/Postmark.PCL/Model/PostmarkMessageBase.cs b/src/Postmark.PCL/Model/PostmarkMessageBase.cs
index ab5f7b6..32fbd4f 100644
--- a/src/Postmark.PCL/Model/PostmarkMessageBase.cs
+++ b/src/Postmark.PCL/Model/PostmarkMessageBase.cs
@@ -2,7 +2,6 @@
using System;
using System.Collections.Generic;
using System.IO;
-using System.Net;
namespace PostmarkDotNet
{
@@ -18,6 +17,7 @@ public PostmarkMessageBase()
{
Headers = new HeaderCollection();
Attachments = new List(0);
+ TrackLinks = LinkTrackingOptions.None;
}
///
@@ -62,6 +62,8 @@ public PostmarkMessageBase()
///
public bool? TrackOpens { get; set; }
+ public LinkTrackingOptions TrackLinks { get; set; }
+
///
/// A collection of optional message headers.
///
diff --git a/src/Postmark.PCL/Model/TemplatedPostmarkMessage.cs b/src/Postmark.PCL/Model/TemplatedPostmarkMessage.cs
index 3e6e6a6..6752da0 100644
--- a/src/Postmark.PCL/Model/TemplatedPostmarkMessage.cs
+++ b/src/Postmark.PCL/Model/TemplatedPostmarkMessage.cs
@@ -9,7 +9,6 @@ public class TemplatedPostmarkMessage : PostmarkMessageBase
public TemplatedPostmarkMessage()
: base()
{
-
}
///
diff --git a/src/Postmark.PCL/Postmark.PCL.csproj b/src/Postmark.PCL/Postmark.PCL.csproj
index 0209ebc..4aaff58 100644
--- a/src/Postmark.PCL/Postmark.PCL.csproj
+++ b/src/Postmark.PCL/Postmark.PCL.csproj
@@ -52,6 +52,9 @@
Model\InboundMessageStatus.cs
+
+ Model\LinkTrackingOptions.cs
+
Model\OutboundMessageStatus.cs
diff --git a/src/Postmark.PCL/PostmarkClient.cs b/src/Postmark.PCL/PostmarkClient.cs
index cf4bab9..0281dff 100644
--- a/src/Postmark.PCL/PostmarkClient.cs
+++ b/src/Postmark.PCL/PostmarkClient.cs
@@ -291,7 +291,8 @@ public async Task GetServerAsync()
public async Task EditServerAsync(String name = null, string color = null,
bool? rawEmailEnabled = null, bool? smtpApiActivated = null, string inboundHookUrl = null,
string bounceHookUrl = null, string openHookUrl = null, bool? postFirstOpenOnly = null,
- bool? trackOpens = null, string inboundDomain = null, int? inboundSpamThreshold = null)
+ bool? trackOpens = null, string inboundDomain = null, int? inboundSpamThreshold = null,
+ LinkTrackingOptions? trackLinks = null)
{
var body = new Dictionary();
body["Name"] = name;
@@ -305,6 +306,7 @@ public async Task EditServerAsync(String name = null, string col
body["TrackOpens"] = trackOpens;
body["InboundDomain"] = inboundDomain;
body["InboundSpamThreshold"] = inboundSpamThreshold;
+ body["TrackLinks"] = trackLinks;
body = body.Where(kv => kv.Value != null).ToDictionary(k => k.Key, v => v.Value);
diff --git a/src/Postmark.PCL/PostmarkClientBase.cs b/src/Postmark.PCL/PostmarkClientBase.cs
index 1452baa..6f5c00b 100644
--- a/src/Postmark.PCL/PostmarkClientBase.cs
+++ b/src/Postmark.PCL/PostmarkClientBase.cs
@@ -85,7 +85,7 @@ protected async Task ProcessRequestAsync(str
var content = new JsonContent(message);
request.Content = content;
}
-
+
request.Headers.Add("Accept", "application/json");
request.Headers.Add(AuthHeaderName, _authToken);
request.Headers.Add("User-Agent", _agent);
diff --git a/src/Postmark/Model/LinkTrackingOptions.cs b/src/Postmark/Model/LinkTrackingOptions.cs
new file mode 100644
index 0000000..9404a15
--- /dev/null
+++ b/src/Postmark/Model/LinkTrackingOptions.cs
@@ -0,0 +1,14 @@
+using Newtonsoft.Json;
+using Newtonsoft.Json.Converters;
+
+namespace PostmarkDotNet
+{
+ [JsonConverter(typeof(StringEnumConverter))]
+ public enum LinkTrackingOptions
+ {
+ None = 0,
+ HtmlAndText = 1,
+ HtmlOnly = 2,
+ TextOnly = 3,
+ }
+}
diff --git a/src/Postmark/Model/PostmarkMessage.cs b/src/Postmark/Model/PostmarkMessage.cs
index 55b2637..6e58b09 100644
--- a/src/Postmark/Model/PostmarkMessage.cs
+++ b/src/Postmark/Model/PostmarkMessage.cs
@@ -1,7 +1,6 @@
using System;
using System.Collections.Generic;
using System.IO;
-using System.Web;
using PostmarkDotNet.Validation;
#if !WINDOWS_PHONE
@@ -11,7 +10,6 @@
using System.Net.Mail;
using System.Net.Mime;
using System.Text;
-using System.Diagnostics.CodeAnalysis;
#else
using Hammock.Silverlight.Compat;
#endif
@@ -166,6 +164,7 @@ public PostmarkMessageBase()
{
Headers = new NameValueCollection(0);
Attachments = new List(0);
+ TrackLinks = LinkTrackingOptions.None;
}
#if !WINDOWS_PHONE
@@ -290,6 +289,11 @@ protected static Encoding resolveViewEncoding(AttachmentBase view, Encoding fall
///
public bool TrackOpens { get; set; }
+ ///
+ /// Setting determining whether to track links, default is "None"
+ ///
+ public LinkTrackingOptions TrackLinks { get; set; }
+
///
/// A collection of optional message headers.
///
diff --git a/src/Postmark/Model/PostmarkServer.cs b/src/Postmark/Model/PostmarkServer.cs
index 8c54453..0f09cab 100644
--- a/src/Postmark/Model/PostmarkServer.cs
+++ b/src/Postmark/Model/PostmarkServer.cs
@@ -79,6 +79,11 @@ public PostmarkServer()
///
public bool TrackOpens { get; set; }
+ ///
+ /// The link tracking setting for this server.
+ ///
+ public LinkTrackingOptions TrackLinks { get; set; }
+
///
/// Inbound domain for MX setup
///
diff --git a/src/Postmark/Postmark.csproj b/src/Postmark/Postmark.csproj
index d5aa497..ccba2e5 100644
--- a/src/Postmark/Postmark.csproj
+++ b/src/Postmark/Postmark.csproj
@@ -94,6 +94,7 @@
+