Preheat oven to 325 degrees.
Cut cornbread into 1/2-inch cubes and in 2 large shallow baking pans bake in middle of oven until just dry, about 20 minutes.
In a large heavy skillet cook red onions, shallots, leeks, celery, herbs with salt and pepper to taste in butter over moderate heat, stirring, until onion mixture is golden brown, softened, about 25 minutes.
If using canned chestnuts, rinse and drain. In a saucepan simmer vacuum-packed or canned chestnuts in 2 cups broth 15 minutes.
In a large bowl, toss together bread, onions, chestnut mixture, remaining 1 1/2 cups broth and salt and pepper to taste and cool completely. Stuffing may be made up to this point 1 day ahead and chilled, covered. Bring stuffing to room temperature before proceeding.
To cook all or part of stuffing outside poultry: In a shallow baking dish bake stuffing in preheated 325 degree oven 45 minutes (for moist stuffing, bake covered entire time; for less moist stuffing with a slightly crisp top, uncover halfway through baking time).
Preheat oven to 400 degrees and butter two 9 by 5 by 3-inch loaf pans.
In a large bowl, sift together flour, baking powder, and salt and whisk in cornmeal and sugar until combined well. In a bowl whisk together milk and eggs until just combined. Add butter to flour mixture and with an electric mixer beat until mixture resembles coarse meal. Beat in egg mixture until just combined (batter will be thin).
Pour batter into pans and bake in middle of oven until golden and a tester comes out clean, about 50 minutes. Cool cornbread in pans on a rack 10 minutes and turn out onto rack to cool completely. Cornbread may be wrapped in plastic wrap and kept in a cool, dry place 2 days or frozen 2 weeks.