  Stars interact with their close-in planets through radiation, gravitation,
and magnetic fields. We investigate the energy input to a planetary atmosphere
by reconnection between stellar and planetary magnetic fields and compare it to
the energy input of the extreme ultraviolet (EUV) radiation field of the star.
We quantify the power released by magnetic reconnection at the boundary of the
planetary magnetosphere that is conveyed to the atmosphere by accelerated
electrons. We introduce simple models to evaluate the energy spectrum of the
accelerated electrons and the energy dissipated in the atmospheric layers in
the polar regions of the planet upon which they impinge. A simple transonic
isothermal wind flow along field lines is considered to estimate the increase
in mass loss rate in comparison with a planet irradiated only by the EUV flux
of its host star. We find that energetic electrons can reach levels down to
column densities of 10^{23}-10^{25} m^{-2}, comparable with or deeper than EUV
photons, and increase the mass loss rate up to a factor of 30-50 in close-in (<
0.10 AU), massive (> 1.5 Jupiter masses) planets. Mass loss rates up to
(0.5-1.0)x10^{9} kg/s are found for atmospheres heated by electrons accelerated
by magnetic reconnection at the boundary of planetary magnetospheres. On the
other hand, average mass loss rates up to (0.3-1.0)x10^{10} kg/s are found in
the case of magnetic loops interconnecting the planet with the star. The
star-planet magnetic interaction provides a remarkable source of energy for
planetary atmospheres, generally comparable with or exceeding that of stellar
EUV radiation for close-in planets. Therefore, it must be included in models of
chemical evolution or evaporation of planetary atmospheres as well as in
modelling of light curves of transiting planets at UV wavelengths.
