  By properly considering the propagation dynamics of the dipole field, we
obtain the full magnetic dipolar interaction between two quantum dipoles for
general situations. With the help the Maxwell equation and the corresponding
Green function, this result applies for general boundary conditions, and
naturally unifies all the interaction terms between permanent dipoles, resonant
or non-resonant transition dipoles, and even the counter-rotating interaction
terms altogether. In particular, we study the dipolar interaction in a
rectangular 3D cavity with discrete field modes. When the two dipoles are quite
near to each other and far from the cavity boundary, their interaction simply
returns the freespace result; when the distance between the two dipoles is
comparable to their distance to the cavity boundary and the field mode
wavelength, the dipole images and near-resonant cavity modes bring in
significant changes to the freespace interaction. This approach also provides a
general way to study the interaction mediated by other kinds of fields.
