Have used pipe and tubing for a pipe fence. Tubing wins hands down. The pipe is PTA to work with and is usually heavily rusted, which eventually eats through the paint no matter how you treat it.
Look around, you can probably find a place that stocks tubing for fences. I use 11 gage for the posts, and 14 gage for the rails. The length of the tubing I got was 21-feet per tube - meaning I could get 3 posts per tube. For my fence, that meant 2-feet in the ground and 5 feet above ground.
Unless you're contemplating having livestock (especially cattle) that will use the fence for scratching, there's no reason to go 4-feet deep. I have my posts 2-feet deep with a 6-inch diameter concrete footing in very sandy soil (little support from the soil) and the fence has been in-place for nearly 10 years. The posts are spaced at 10-foot intervals. The fence is finished with horse wire to keep the dog in - and the neighbors' dogs out.
What you'll find, is that as you put the rails on, the fence becomes much stronger as you're tying everything together. In fact, the power company excavated under one corner post to get to an underground service, leaving the post with the footing exposed with a hole under it over a weekend. It sagged very slightly (about 2-inches from the weight of the concrete footer), but when they filled the hole, they lifted the post back level and backfilled - no problem.
I used 4-inch, schedule 40 tubing for gate posts, and those I did set 4-feet deep in concrete footings. I have two gate panels across my driveway - each panel is 11-feet long.