public void RemoveRecipients() { MessageEnvelope envelope = new MessageEnvelope(TestMessage); DirectAddressCollection toRemove = new DirectAddressCollection(); toRemove.Add(new DirectAddress("<*****@*****.**>")); toRemove.Add(new DirectAddress("<*****@*****.**>")); toRemove.Add(new DirectAddress("<*****@*****.**>")); toRemove.Add(new DirectAddress("<*****@*****.**>")); Assert.DoesNotThrow(() => envelope.RemoveFromRoutingHeaders(toRemove)); string outputText = null; Assert.DoesNotThrow(() => outputText = envelope.SerializeMessage()); Message outputMessage = Message.Load(outputText); Assert.True(outputMessage.Bcc == null); this.CheckHeaderRaw(outputMessage.Cc, 2); this.CheckCollection(outputMessage.Cc, new string[] {"*****@*****.**", "*****@*****.**"}, new string[] {"*****@*****.**>", "*****@*****.**"}); this.CheckHeaderRaw(outputMessage.To, 1); this.CheckCollection(outputMessage.To, new string[] { "*****@*****.**"}, new string[] { "*****@*****.**"}); }
protected virtual void UpdateMessageText(ISmtpMessage message, MessageEnvelope envelope) { string messageText = envelope.SerializeMessage(); if (string.IsNullOrEmpty(messageText)) { throw new SmtpAgentException(SmtpAgentError.EmptyResultFromAgent); } message.Update(messageText); }