Cook the spaghetti as usual and then drain. Heat the butter in a saucepan and sauté the onions for about 3 minutes. Now add the peppers and cook with them. Stir it again and again. Then add the tomatoes and ham to the pot. Simmer a little more and season with salt and pepper (tip: I always add a little vegetable stock to it).
Now we fill the spaghetti in a baking dish and mix in some cheese. Now the vegetables and ham from the pot are added and we mix everything again. Now simply sprinkle the rest of the cheese on top.
Now everything comes in the oven for 15-20 minutes or until the cheese is golden brown.