An exact transformation, which we call the master identity, is obtained for the first time for the series Sigma(infinity)(n=1) sigma(a)(n)e(-ny) for a is an element of C and Re(y) > 0. New modular-type transformations when a is a nonzero even integer are obtained as its special cases. The precise obstruction to modularity is explicitly seen in these transformations. These include a novel companion to Ramanujan's famous formula for sigma (2m + 1). The Wigert-Bellman identity arising from the a = 0 case of the master identity is derived too. When a is an odd integer, the well-known modular transformations of the Eisenstein series on SL2 (Z), that of the Dedekind eta function as well as Ramanujan's formula for sigma (2m + 1) are derived from the master identity. The latter identity itself is derived using Guinand's version of the VoronoT summation formula and an integral evaluation of N. S. Koshliakov involving a generalization of the modified Bessel function K-v(z). Koshliakov's integral evaluation is proved for the first time. It is then generalized using a well-known kernel of Watson to obtain an interesting two-variable generalization of the modified Bessel function. This generalization allows us to obtain a new modular-type transformation involving the sums-of-squares function r(k)(n). Some results on functions self-reciprocal in the Watson kernel are also obtained.