diff --git a/src/Postmark.Tests/ClientSendingTests.cs b/src/Postmark.Tests/ClientSendingTests.cs index cda08da..6da2683 100644 --- a/src/Postmark.Tests/ClientSendingTests.cs +++ b/src/Postmark.Tests/ClientSendingTests.cs @@ -43,6 +43,28 @@ await _client.SendMessageAsync( "If it has been more than 45 days since these tests have been run on this server, try re-running this test." ); } + + [Fact] + public async void Client_CanSendASingleMessage_With_CC() + { + var result = await _client.SendMessageAsync(WRITE_TEST_SENDER_EMAIL_ADDRESS, + WRITE_TEST_EMAIL_RECIPIENT_ADDRESS, + String.Format("Integration Test - {0}", TESTING_DATE), + String.Format("Plain text body, {0}", TESTING_DATE), + String.Format("Testing the Postmark .net client, {0}", TESTING_DATE), + new Dictionary() + { + { "X-Integration-Testing" , TESTING_DATE.ToString("o")} + }, + new Dictionary() { + {"test-metadata", "value-goes-here"}, + {"more-metadata", "more-goes-here"} + }, cc: WRITE_TEST_EMAIL_RECIPIENT_ADDRESS); + + Assert.Equal(PostmarkStatus.Success, result.Status); + Assert.Equal(0, result.ErrorCode); + Assert.NotEqual(Guid.Empty, result.MessageID); + } [Fact] public async void Client_CanSendASingleMessage() diff --git a/src/Postmark/Model/PostmarkMessage.cs b/src/Postmark/Model/PostmarkMessage.cs index 0405a22..ee6a31b 100644 --- a/src/Postmark/Model/PostmarkMessage.cs +++ b/src/Postmark/Model/PostmarkMessage.cs @@ -23,8 +23,9 @@ public PostmarkMessage() /// A collection of additional mail headers to send with the message. (optional) /// A dictionary of metadata to send with the message. (optional) /// The message stream used to send this message. If not provided, the default transactional stream "outbound" will be used. (optional) + /// An email address for a CC recipient. public PostmarkMessage(string from, string to, string subject, string textBody, string htmlBody, - HeaderCollection headers = null, IDictionary metadata = null, string messageStream = null) : base() + HeaderCollection headers = null, IDictionary metadata = null, string messageStream = null, string cc = null) : base() { From = from; To = to; @@ -34,6 +35,7 @@ public PostmarkMessage(string from, string to, string subject, string textBody, Headers = headers ?? new HeaderCollection(); Metadata = metadata; MessageStream = messageStream; + Cc = cc; } /// diff --git a/src/Postmark/PostmarkClientExtensions.cs b/src/Postmark/PostmarkClientExtensions.cs index 09775cb..e4b944c 100644 --- a/src/Postmark/PostmarkClientExtensions.cs +++ b/src/Postmark/PostmarkClientExtensions.cs @@ -25,15 +25,16 @@ public static class PostmarkClientExtensions /// The HTML Body to be used for the message, this may be null if TextBody is set. /// A collection of additional mail headers to send with the message. /// The message stream used to send this message. + /// An email address for a CC recipient. /// A with details about the transaction. public static async Task SendMessageAsync(this PostmarkClient client, string from, string to, string subject, string textBody, string htmlBody, IDictionary headers = null, IDictionary metadata = null, - string messageStream = null) + string messageStream = null, string cc = null) { var message = new PostmarkMessage(from, to, subject, textBody, htmlBody, - new HeaderCollection(headers), metadata, messageStream); + new HeaderCollection(headers), metadata, messageStream, cc); return await client.SendMessageAsync(message); }