Sex hurts!

I just got over a yeast infection, my boyfriend and I tried to have sex today and it hurt, he was barely in and it hurt. Any reason why it hurt?