The picture above shows an old water heater (located in detached garage) that I'd like to replace. Notice that the T&P release valve, which is on the top, connects with some piping over to a copper discharge tube which runs down and outside through the wall. I did not do this pipe work, but bought the house with this already set up.
Newer water heaters have T&P release valves on the side of the unit (and which point down). What would be the best (and also the easiest for a newbie DIYer) way to connect a new T&P release valve to this discharge pipe in a way which was safe and up to code? I thought maybe I could cut the copper pipe mid-way down, and then use a flex connector from the T&P valve horizontally (and slightly downhill) to the copper pipe. However, I'm not sure this arrangement is safe and up to code (seems this is debated online). Is there a good way without sweating pipe to connect to this discharge line? Should I forget this discharge line altogether and just put a simple off-the-shelf vertical discharge tube like this into the new water heater, and have the tube pointing down towards a pan to catch water? Would that be safe and up to code? The rest of the water heater installation seems trivial, but this discharge line is the one thing I'm uncertain of how to handle. Any suggestions would be more than welcome!