Hello reader,,
This might be a very simple question, but what to just say about it, i'm facing it
Actually i'm developing a web App and i want email feature in that....
I'm sending mail from my development machine i.e localhost
This is the setting in web.config
-
<system.net>
-
<mailSettings>
-
-
<smtp>
-
<network host="localhost" port="25" userName="reverso@gmail.com" password="somepassword" />
-
</smtp>
-
</mailSettings>
-
</system.net>
-
and this is the code to send the email
-
try
-
{
-
MailMessage mail = new MailMessage("from", "to","Some subject", "Mail Body");
-
SmtpClient sm = new SmtpClient("localhost", 25);
-
sm.Send(mail);
-
Page.Controls.Add(new LiteralControl("<script language='javascript'> alert('Mail Sent Successfully'); </script>"));
-
-
}
-
catch (Exception rr)
-
{
-
Page.Controls.Add(new LiteralControl("<script language='javascript'> alert('" + rr.Message + "'); </script>"));
-
}
-
Actually im facing problem sending mail plz someone verify this code
whether is it proper or not...
I'm getting failure sending mail error every time....
Plz help me with this it's urgent....