internal Builder(Message immutable)
            {
                this.immutable = immutable;

                this.subject = immutable.Subject;
                this.body = immutable.Body;
            }
 public Message ToImmutable()
 {
     var author = this.author.IsDefined ? (this.author.Value != null ? this.author.Value.ToImmutable() : null) : this.immutable.Author;
     var to = this.to.IsDefined ? (this.to.Value != null ? this.to.Value.ToImmutable() : null) : this.immutable.To;
     var cc = this.cc.IsDefined ? (this.cc.Value != null ? this.cc.Value.ToImmutable() : null) : this.immutable.Cc;
     var bcc = this.bcc.IsDefined ? (this.bcc.Value != null ? this.bcc.Value.ToImmutable() : null) : this.immutable.Bcc;
     return this.immutable = this.immutable.With(
         ImmutableObjectGraph.Optional.For(author),
         ImmutableObjectGraph.Optional.For(to),
         ImmutableObjectGraph.Optional.For(cc),
         ImmutableObjectGraph.Optional.For(bcc),
         ImmutableObjectGraph.Optional.For(this.Subject),
         ImmutableObjectGraph.Optional.For(this.Body));
 }
示例#3
0
 public void SendMessages(Message message, params string[] addresses)
 {
     addresses.Each(addr => _mailService.Send(message, addr));
 }