Quantum electrodynamics near a photonic bandgap