+1 vote

How can I send an email to 2 or more addresses in the "to" line?

I tried "x@x.com; y@y.com" and it threw an exception.

by

1 Answer

0 votes
 
Best answer

MailBuilder.To is a collection - create and add a MailBox object for each email recipient:

MailBuilder builder = new MailBuilder();
builder.To.Add(new MailBox("first@example.com"));
builder.To.Add(new MailBox("second@example.com"));
builder.Text = "Hello";
....
IMail email = builder.Create();

Using fluent interface invoke To method for each recipient:

IMail email = Mail
    .Text(@"Hello")
    .To("first@example.com")
    .To("second@example.com")
    .From("from@example.com")
    .Subject("Subject")
    .Create();
by (297k points)
...