Skip to content

[Bug] SendExchangeEmailWithAttachments: AttachmentFromString attachments are duplicated #65

@HiQ-wipa

Description

@HiQ-wipa

Description

If the task SendExchangeEmailWithAttachments is given multiple AttachmentFromString attachments, then the first attachment is duplicated.

Steps to reproduce

Call SendExchangeEmailWithAttachments with 2 AttachmentFromString attachments.

Expected behaviour

Each attachment should only appear once in the resulting email.

Notes

This occurs because the allAttachmentFilePaths loop is contained within the attachments loop. Abridged, the code looks like this:

foreach (var attachment in attachments) {
    allAttachmentFilePaths.Add(getFilePath(attachment));
    foreach (var filePath in allAttachmentFilePaths) {
        attachFileToEmail(filePath, email);
    }
}

In other words, with 2 attachments, the first iteration of the outer loop attaches the first attachment, and the second iteration attaches the first attachment again and then the second attachment.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions