  We compute cosmic microwave background (CMB) anisotropy constraints on exotic
forms of energy injection in electromagnetic (e.m.) channels over a large range
of timescales. These constraints are very powerful around or just after
recombination, although CMB keeps some sensitivity e.g. to decaying species
with lifetimes as long as $10^{25}\,$s. We review here complementary with CMB
spectral distortions and primordial nucleosynthesis bounds, which dominate at
earlier timescales. For the first time, we describe the effects of the e.m.
energy injection on the CMB power spectra as a function of the injection epoch,
using the lifetime of a decaying particle as proxy. We identify a suitable
on-the-spot approximation. Our results are of interest not only for early
universe relics constituting (a fraction of) the dark matter, but also for
other exotic injection of e.m. radiation. For illustration, we apply our
formalism to: i) Primordial black holes of mass $\in [10^{13.5},10^{16.8}]$ g,
showing that the constraints are comparable to the ones obtained from gamma-ray
background studies and even dominate below $\sim 10^{14}$g. ii) To a peculiar
mass-mixing range in the sterile neutrino parameter space, complementary to
other astrophysical and laboratory probes. iii) Finally, we provide a first
estimate of the room for improvement left for forthcoming 21 cm experiments,
comparing it with the reach of proposed CMB spectral distortion (PiXiE) and CMB
angular power spectrum (CORE) missions. We show that the best and most
realistic opportunity to look for this signal (or to improve over current
constraints) in the 21 cm probe is to focus on the Cosmic Dawn epoch,
$15\lesssim z\lesssim30$, where the qualitatively unambiguous signature of a
spectrum in emission can be expected for models that evade all current
constraints.
