/// <summary> /// Initializes a new instance of the <see cref="Message"/> class. /// </summary> /// <param name="address">The address.</param> /// <param name="headers"></param> /// <param name="attachment"></param> /// <param name="replyTo"></param> public Message(Address address, Uri feedHref, NameValueCollection headers, Attachment attachment, Uri replyTo = null) { Address = address; ReplyTo = replyTo; MessageId = Guid.NewGuid(); Headers = new MessageHeaders(); var keys = headers.AllKeys; keys.Each(key => Headers.AddHeader(key, headers[key])); Content = new MessageContent(attachment.ContentType, attachment.TransferEncoding, attachment.ContentStream); FeedHref = feedHref; Name = new Name(MessageId.ToString()); ReplyTo = replyTo; }
/// <summary> /// Copies this instance. /// </summary> /// <returns>MessageHeaders.</returns> public MessageHeaders Copy() { var newMessageHeaders = new MessageHeaders(); foreach (var key in _headers.AllKeys) { newMessageHeaders.AddHeader(key, _headers[key]); } return newMessageHeaders; }