AddAttachmentAsync calls Stream.ReadAsync once with the assumption that the stream is read from beginning to end in one call, but that is not guaranteed. The correct pattern is to inspect the return value, which is the number of bytes read in the operation, and continue reading to the end of the stream. This results in mangled attachments when the stream is not fully read in one call.