Amines and ammonia react with alkanoyl halides to form amides. The reaction is favored with an excess of amine, in order to eliminate the hydrochloric acid released in the reaction.
The mechanism occurs in two stages:
Stage 1. Addition of the amine to the halide
Stage 2. Chloride removal
This reaction can only be carried out with primary or secondary amines. Tertiary amines do not form amides and give rise to alkanoyl ammonium salts.