public MailSoap12TransportBinding(Message msg) { // Set the from and to headers if (msg.Headers.From != null) { _from = TrimMailAddress(msg.Headers.From.Uri); } if (msg.Headers.To != null) { _to = TrimMailAddress(msg.Headers.To); } // In case there happens to be a replyTo header, use it if (msg.Headers.ReplyTo != null) { _replyTo = msg.Headers.ReplyTo.ToString(); } // Create a new ID for the mail and uses the from address as ID due to the specification _messageId = Guid.NewGuid().ToString() + "@127.0.0.1"; // Create the attachment _attachment = new MailSoap12TransportBindingAttachment(msg); }
/// <summary> /// Constructor /// </summary> /// <param name="msg">A WCF Message that will be used to extract the necessary fields from</param> /// <param name="from">Sender</param> /// <param name="to">Receiver</param> /// <param name="replyTo">To whom one should reply</param> /// <param name="messageId">The Message-Id of the mail</param> public MailSoap12TransportBinding(Message msg, string from, string to, string replyTo, string messageId) { _from = from; _to = to; _replyTo = replyTo; _messageId = messageId; _attachment = new MailSoap12TransportBindingAttachment(msg); }