Step by step

Put a foil on a baking tray, arrange your spaghetti on it, then seal it and cook it for 10-15 minutes.

Tips
The ideal foil for a parcel is an alluminium one,  as it's easy to fold and seal it. You can also use an oven paper foil, that must be wet, so as to prevent browning. If you use an oven paper foil, you can seal helping yourself with some egg white.
Trivia
In order to obtain a perfect dish when cooking it in a parcel, you need a little of foresight: don't put cold foods into the parcel, and don't arrange it straight on the grill.