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
Expand|Select|Wrap|Line Numbers
- <system.net>
- <mailSettings>
- <smtp>
- <network host="localhost" port="25" userName="reverso@gmail.com" password="somepassword" />
- </smtp>
- </mailSettings>
- </system.net>
Expand|Select|Wrap|Line Numbers
- 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>"));
- }
whether is it proper or not...
I'm getting failure sending mail error every time....
Plz help me with this it's urgent....