Unfortunatelly, you was not specisic enough. This would be better to post the values of the variabless as well as the return value of your function. I also believe that you are using a properly configured SMTP server.
Perhaps reading a tutorial may help.