Mail on Iphone says the connection to the server failed?

I am hoping someone can help me with this, but my yahoo mail account I have set up on my Iphone has never given me a problem. Then, yesterday my Iphone 4 had an upgrade so I upgraded it. Ever since then every time I try to check my email a message comes up saying "the connection to the server failed" I have tried turning off my phone and restarting it, but that doesn't help, and I tried deleting my account and adding it back, but nothing works. It does however work when connected to the 3g, but not the wifi. If you can help me Thank you so much.