private MailSoap12TransportBinding CreateMailMessage(Message message) { MailSoap12TransportBinding mail = new MailSoap12TransportBinding(message); // 2. Check mail headers of incoming request if (_requestMessage.ReplyTo != null && _requestMessage.ReplyTo != "") { mail.To = _requestMessage.ReplyTo; } else if (_requestMessage.From != null && _requestMessage.From != "") { mail.To = _requestMessage.From; } else { throw new RaspEmailReplyCouldNotBeSentException(new dk.gov.oiosi.communication.handlers.email.MailBindingFieldMissingException("From")); } // Try to set the FROM header of the mail if (mail.From == null || mail.From == "") { mail.From = MailSoap12TransportBinding.TrimMailAddress(this.pMailHandler.InboxServerConfiguration.ReplyAddress); } //TODO: remove this hack, only for testing message.Headers.To = new Uri("mailto:" + _requestMessage.From); WCFLogger.Write(System.Diagnostics.TraceEventType.Verbose, "RequestContext created the reply mail"); return(mail); }
private MailSoap12TransportBinding CreateMailMessage(Message message) { // Attach a To header, so that the SMTP/MIME SOAP 1.2 protocol can be complied with message.Headers.To = this.RemoteAddress.Uri; MailSoap12TransportBinding mail = new MailSoap12TransportBinding(message); if (_mailHandler.OutboxServerConfiguration.ReplyAddress == null || _mailHandler.OutboxServerConfiguration.ReplyAddress == "") { throw new dk.gov.oiosi.communication.handlers.email.MailBindingFieldMissingException("replyAddress in the configuration file"); } else { mail.From = MailSoap12TransportBinding.TrimMailAddress(_mailHandler.OutboxServerConfiguration.ReplyAddress); } if (mail.To == null || mail.To == "") { mail.To = MailSoap12TransportBinding.TrimMailAddress(this.RemoteAddress.Uri); } return(mail); }
private MailSoap12TransportBinding CreateMailMessage(Message message) { // Attach a To header, so that the SMTP/MIME SOAP 1.2 protocol can be complied with message.Headers.To = this.RemoteAddress.Uri; MailSoap12TransportBinding mail = null; string replyAddress = _mailHandler.OutboxServerConfiguration.ReplyAddress; if (string.IsNullOrEmpty(replyAddress)) { throw new MailBindingFieldMissingException("replyAddress in the configuration file"); } else { string fromAddress = MailSoap12TransportBinding.TrimMailAddress(_mailHandler.OutboxServerConfiguration.ReplyAddress); mail = new MailSoap12TransportBinding(message, fromAddress); mail.From = fromAddress; } if (mail.To == null || mail.To == "") { mail.To = MailSoap12TransportBinding.TrimMailAddress(this.RemoteAddress.Uri); } return(mail); }