hi all
i want to sent email from my website , to notify the person that he has logged to the website.
i tried following code:
string from_m = "mailto@gmail.com", sub = "success", mbody = "mail body";
MailMessage mailObj = new MailMessage(from_m ,txbemail.Text,sub,mbody);
SmtpClient SMTPserver = new SmtpClient("localhost");
try
{
SMTPserver.Send(mailObj);
}
catch(Exception ex)
{
Label7.Text = ex.ToString();
}
txbemail.Text = "";
txbpwd.Text = "";
if (flag == 1)
{
btsignin.PostBackUrl = "staff_profile.aspx";
}
else
{
Label6.Text = "Invalid User,<br />Check Your Email Id and Password.";
}
and iam getting the following error...
System.Net.Mail.SmtpException: Failure sending mail. ---> System.IO.IOException: Unable to read data from the transport connection: net_io_connectionclosed. at System.Net.Mail.SmtpReplyReaderFactory.ProcessRead(Byte[] buffer, Int32 offset, Int32 read, Boolean readLine) at System.Net.Mail.SmtpReplyReaderFactory.ReadLines(SmtpReplyReader caller, Boolean oneLine) at System.Net.Mail.SmtpReplyReaderFactory.ReadLine(SmtpReplyReader caller) at System.Net.Mail.SmtpReplyReader.ReadLine() at System.Net.Mail.SmtpConnection.GetConnection(String host, Int32 port) at System.Net.Mail.SmtpTransport.GetConnection(String host, Int32 port) at System.Net.Mail.SmtpClient.GetConnection() at System.Net.Mail.SmtpClient.Send(MailMessage message) --- End of inner exception stack trace --- at System.Net.Mail.SmtpClient.Send(MailMessage message) at home_page.btsignin_Click(Object sender, EventArgs e) in e:\kfri_auto\automate\home_page.aspx.cs:line 11
iam using visual studio 2008
iis 5.1
can any one help me
plzz
i googled a lot..but not clear
plz help
will be great
thanks in advance