I know it may seem harsh to smack a horse, but when he is trying to inflict pain on you on purpose, you have to do something about it. Give him a smack, or if you choose to ignore it when he bites you, he probably will carry on doing it.
But you must also look at the reasons he is biting you. Is he scared, or is he just being cheeky? If he is scared, or if he started doing it because he was being hurt in any way, then smacking or disciplining him would make matters worse.
If that is the case, you have to go way back and find out what is scaring him, and see if you can try and do something about it, maybe get someone who can help you.
I know of two real life examples of a cheeky horse and a scared horse.
One of the cheeky horse was called Sweet Prince. He just started biting out of fun. His owners never actually did anything about his biting...and it just got worse. I don't know what happened to him after he moved from the barn where I'm boarding though.
One of the scared horse is Prins. When he used to stay in a field (before I knew him), these people used to come and harrass him, by throwing things at him and scaring him. He eventually started biting to protect himself because he was scared of getting hurt. He was later bought by a guy who worked with him and gained him trust, now Prins never bites the guy anymore, but is still wary of other people who come near him.
I hope this helps, and good luck.