The Mannich reaction is an organic reaction used to convert a primary or secondary amine and two carbonyl compound (one non-enolizable and one enolizable) to a β-amino carbonyl compound, also known as a Mannich base, using an acid or base catalyst. In the acid catalyzed mechanism both carbonyl compounds get protonated at the oxygen. The enolizable carbonyl compound, which has an α-hydrogen, then gets deprotonated to form an enol intermediate. The non-enolizable carbonyl compound reacts with the amine to form an iminium ion. The enol intermediate then attacks the iminium ion which after deprotonation provides the final Mannich base product.
Mannich, C.; Krösche, W. Arch. Pharm. Pharm. Med. Chem. 1912, 250, 647–667.