Stream attachment in mail

How I can do to send attachment like array of bytes. I try to use stream but I don’t understand exactly. Do you have a sample of it

thanks