On the contrary, this plays out differently in the books where it is Bilbo who puts the Ring in the envelope. Answering this requires a bit of background info from the books.
Gandalf was afraid of the Ring's influence on him
In the books, Gandalf had touched the Ring twice before he left the Shire. Of course, that doesn't mean that Gandalf's fear of the Ring was purely an invention by PJ. Gandalf, like other powerful beings in Middle-earth (namely Galadriel), was tempted by the power of the Ring, because he believed that with the Ring as his, he could defeat Sauron.
'But I have so little of any of these things! You are wise and powerful. Will you not take the Ring?'
'No!' cried Gandalf, springing to his feet. 'With that power I should have power too great and terrible. And over me the Ring would gain a power still greater and more deadly.' His eyes flashed and his face was lit as by a fire within. 'Do not tempt me! For I do not wish to become like the Dark Lord himself. Yet the way of the Ring to my heart is by pity, pity for weakness and the desire of strength to do good. Do not tempt me! I dare not take it, not even to keep it safe, unused. The wish to wield it would be too great, for my strength. I shall have such need of it. Great perils lie before me.'
The Lord of the Rings, The Fellowship of the Ring, Chapter 2, The Shadow of the Past
However in doing so Gandalf would set himself up as the next Dark Lord, and therefore chooses not to take the Ring from Frodo.
Frodo on the other hand, was not as "powerful" per se, as Gandalf, and would not be able to use the Ring as effectively, if at all.
So, really, Gandalf could touch the Ring, but he was fearful that having too long contact with the Ring would test his limits, and he would claim the Ring in order to save Middle-earth (and afterwards, ironically, becoming as bad as Sauron).
Peter Jackson's The Lord of the Rings adaptation
As stated above, Gandalf sealing the Ring in an envelope was a movie invention. It is likely that this was added to emphasise on the danger of the Ring in general, and to a powerful individual like Gandalf it was even more dangerous.
Is there any passage from any Tolkien book that says touching the Ring activates its magical powers?
If the magical powers you're referring to is corruption, deceit and evil, being near to the Ring does indeed corrupt you. Since its creation, only Sauron himself, Isildur, Gollum, Bilbo, Sam and Frodo have actually worn the Ring, not merely touched it. Not counting Sauron himself, only 4 mortals have worn the Ring that can give evidence to this direct corruption of touching the Ring.
This quote from the reputable Tolkien's Gateway sums it up nicely.
Part of the nature of the Ring was that it slowly but inevitably corrupted its wearer, regardless of any intentions to the contrary. Whether this was specifically designed into the Ring's magic or is simply an artifact of its evil origins is unknown. (Sauron might be expected to endow his One Ring with such a property, but he probably never intended anyone besides himself to wear it. It may be a side-effect of the portion of Sauron's will that lies within the Ring, influencing the wearer.) For this reason the Wise, including Gandalf, Elrond and Galadriel, refused to wield it in their own defence, but instead determined that it must be destroyed. It appears that Hobbits, being more pure of heart than Men, and far less powerful than Elves, were the ideal vessels to resist its seductive power; this explains why Frodo and Bilbo bore it for long periods of time with very little ill effect. Even Gollum had not turned into a Wraith after 500 years of bearing the Ring.
In Boromir's case, being in close proximity of the Ring and also knowing of the Ring's power and presence caused his eventual corruption. The Hobbits, Gollum included, are of a purer heart as compared to Men, and therefore were able to resist the Ring's "magical powers" longer, but in the case of Frodo, weariness of his long physical and mental journey to Sammath Naur had exhausted him, and he finally succumbed to the Ring's corruption at that fateful moment.
So to answer your question, Gandalf only sealed the Ring inside an envelope in the movies, and this was likely added by Peter Jackson to add to the tension of the scene and emphasise on Its danger to an inherently powerful being like Gandalf.
Gandalf's fear of the Ring is present in the books, but PJ portrayed it in the movies slightly differently by 1) Having Gandalf not touch the Ring by putting it in an envelope and 2) Showing his refusal in accepting the Ring, enveloped or not, from Frodo. The books portrays Gandalf's fear solely with 2).