Use a spray bottle full of just either plain water or if that doesn't work use a 50/50 mix of vinegar and water. Dog have a strong sense of smell and the vinegar is WAY stronger smell to them then you. Spray them every time they bark and say "No". I used the method on my neighbors dog when they wouldn't stop him from going crazy when I mowed the fence line. I carried the bottle hanging on my pocket and when I would approach the fence I would spray the dog. After about 4 rounds he stopped completely.

part of the responsibility lies with the mailman, and the other part with you. You have to convince the dog that you are the one that needs to defend the territory (your house, yard, etc), this is usually the hardest part. The other part is that the mailman needs to not act like a jerk to your dog, and try and make friends with it. While this sounds touchy-feely, a slice of bologna goes a long way when making friends with a dog. He needs to make sure that he doesn't give the dog the bologna until it stops barking though! No Feeding the doggie as a preemptive strike to get to the mailbox! ;)

Barking is usually a protective response. The dog is saying "this area is mine and I will defend it". Then the mailman leaves and the dog feels as if it has defended its territory. To combat unwanted behavior the dog has to feel that the action is wrong or unpleasant. I find that a shock collar works well. If you think thats too harsh then you simply have to negatively reinforce the behavior as it is happening. This can be with a stern "NO" or by holding the dog as its pack leader would, Gently but firmly put them on their side and hold your finger tips against their neck to simulate a bite. Watch "The dog whisperer" or get some books on training at the library. Remember that you are trying to stop behaviors that were either learned or bred in over thousands of years so you must be consistent and diligent. Most people simply "have" a dog instead of taking responsibility for training them. Thats why we euthanize hundreds of thousands of dogs every year. The owners are too lazy to train them so they dump them instead. If you learn to understand the way they think and then train them, the experience of dog ownership can be better than you ever thought!