Whenever two dissimilar metals are connected or placed together, galvanic action takes place. Galvanic action is an electrical phenomenon that causes a small current to flow. Over time, this current flow causes oxygen to penetrate deep into metals, causing corrosion. The end result is rust in ferrous metals, and oxidation and degradation in non-ferrous metals. If the metals are exposed to the weather, corrosion sets in quicker, since water usually contains dissolved minerals which are conductive. The only solutions are to use the same kind of metals when coupling, or placing a non-conductive block between dissimilar metals.
Whenever two dissimilar metals touch, a small, almost imperceptible electrical current starts to flow. This is called galvanic action. Metal researchers at Virginia's Community Colleges developed a list of 19 metals, from the most reactive to the least reactive, in terms of galvanic action. The most reactive metal is magnesium, with the least reactive metal being gold. Iron and steel is No. 6 on the list, meaning it's closer to the reactive side than the non-reactive side.
Rusting and Corrosion
Galvanic action causes iron to rust. By a process still under investigation, somehow oxygen is transported into the metal, causing iron oxidation, which is rust. Therefore, any iron in contact with a non-iron metal will rust. Galvanic action is a deep electrochemical process, and not just a surface reaction. There's no way to stop it if two dissimilar metals touch.
Weather and Rusting
If the connection is exposed to the elements, the time frame of rusting is increased. Rainwater is seldom pure water, but contains dissolved minerals. These minerals are conductive, and speed up the electrical flow. Also, many communites spread salt in the wintertime. Salt is extremely conductive, and will greatly enhance the electrical flow. This has directly applicable real-world ramifications. For example, an iron gas pipe is connected to an outdoor meter. The installation technician is a novice, and did not realize the meter body is made of brass. He incorrectly connected the two. The system will work for a while, but over time, the iron pipe will rust, eventually leading to a gas leak. This is due to pinhole rust spots in the pipe caused by galvanic action hastened by conductive minerals settling on the assembly.
Two methods can prevent galvanic action. Either using similar metals, or placing a non-conductive block between the iron and the non-iron parts. Using similar metals is easy. You use iron couplings and fittings with iron pipe. Placing a block is a little trickier, but is a requirement. Blocks between structural members can be dense plastics or hard rubber. Weber State University makes it a performance requirement to place non-conductive blocks between exterior iron railings and dissimilar metals to stop galvanic action.