How do you contract mediastinitis?

After surgery. Most commonly after sternotomy and heart surgery, but it can happen after other operations, after instrumentation, such as esophagoscopy, and ocassionally after foreign body perforation of esophagus, or spontaneously.