First of all, the Stream that you supply to an attachment is not read until you actually send a message. That should make sense enough, but sometimes it's easy to forget. If your stream relies on some other resource that was disposed of by the time the message is sent, the client will fail to send your message.
Secondly, if you are writing into a Stream that will later be read by an Attachment, make sure you set the Position back to 0. Otherwise, you may end up with zero-length attachments even though your stream has data! Attachment does not appear to rewind the Stream for you; it reads from whatever position the Stream is currently at.