If you have a look at the source for an email with an attachment theres mime type and boundarys (and
other stuff).
You can use this as a guide to building an email with attachments. Just put in your data instead of whats already there.
There are some already written classes for php that deal with mime email. Have a look around and find one thats easy to work with.
hope it helps