0 votes

when i create an email to be forwarded the new email contains more then one 'from' address.
While the Mailbuilder looks good, till Create() is called.

var forwardBuilder = _importedEmail.Forward();                  
forwardBuilder.IncludeAttachments = true;

MailBuilder mailBuilder = forwardBuilder.Forward(
    new MailBox( fromAddress.Address, fromAddress.Name));

// after the next line it goes wrong
IMail forward = mailBuilder.Create();

forward.From show also the original 'From' address

How can I prevent this getting more then one From address?

by (2.0k points)
edited by

2 Answers

0 votes

I'm 99% sure that it behaves correctly.

Here's the test:

IMail original = Fluent.Mail.Text("")

ForwardBuilder forwardBuilder = original.Forward();
MailBuilder builder = forwardBuilder.Forward(
    new MailBox("me@example.com"));

IMail forwarded = builder.Create();

Assert.AreEqual(1, forwarded.From.Count);
Assert.AreEqual("me@example.com", forwarded.From[0].Address);

It behaves the same for multiple from addresses in original email.

When creating a forwarded email, ForwardBuilder does not copy From, Cc, Bcc, To collections at all.

by (298k points)
0 votes

the sample works correct.

i'll look into what I'm doing wrong..
i've a From object with Capacity : 4. Count: 3 ..

I imported a saved email message and wanted that to be forwarded. Maybe its come form the source email.


by (2.0k points)
edited by