0 votes
by (210 points)

Is there any way to avoid this, other can copying entire stream to buffer, before passing it to MailMessage.Load?

Applies to: Rebex Secure Mail

1 Answer

+1 vote
by (147k points)
selected by
 
Best answer

You can disable closing the input stream by enabling the DoNotCloseStreamAfterLoad option:

var mail = new MailMessage();
mail.Options |= MimeOptions.DoNotCloseStreamAfterLoad;
mail.Load(input);
...