You'll be best served by using green or pressure treated lumber for your fence posts. Anything less will be subject to rapid decay. Additionally 2x4s are inadequate for a wood fence, and you'll need to step up to 4x4s. Depending upon how long you want the fence to last, you might also consider .6 retention grade, or not to confuse you, using a 6x6 post. If you have corners, using 6x6 on the corners would also be aestheically and structurally wise.
The CCA phaseout is also a valid point, but the CCA treated lumber actually holds up to insects a little better according to heresay.