You need to ensure the setting for the smtp server are correct. Localhost is generally not used. Instead you should us the ip address, or dns name, of the server configured as your mail server.
A good place for these setting is in the web.confg file
<system.net>
<mailsettings>
<smtp from="mail@maydomain.com">
<network host="some_server" port="25" username="name" password="password" defaultcredentials="true" />
</smtp>
</mailsettings>
</system.net>
You can also find tutorials here
http://www.aspnettutorials.com/tutorials/email/[
^]