naura 0 Newbie Poster

I send mail in asp.net using kerio .It work fine when i use string variable to get id But i use textboxes to get id it gives following err:

Read from Stream threw an System.Exception: System.IO.IOException: Unable to read data from the transport connection: A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond. ---> System.Net.Sockets.SocketException: A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond
   at System.Net.Sockets.Socket.Receive(Byte[] buffer, Int32 offset, Int32 size, SocketFlags socketFlags)
   at System.Net.Sockets.NetworkStream.Read(Byte[] buffer, Int32 offset, Int32 size)
   --- End of inner exception stack trace ---
   at System.Net.Sockets.NetworkStream.Read(Byte[] buffer, Int32 offset, Int32 size)
   at OpenSmtp.Mail.Smtp.ReadFromStream(NetworkStream& nw)

Code is:

string a = "afsah@localhost";
   //   string b = "abc@localhost";
        string a = T1.Text.ToString();
        string b = T2.Text.ToString();
        MailMessage msg = new MailMessage(a,b);
       msg.Subject = T3.Text.ToString();
       msg.Body = msg1.Text.ToString();
      //  msg.Subject = "Email subject here";
      //msg.Body = "Email text here";
        Smtp smtpClient = new Smtp("localhost", 26);
        smtpClient.SendMail(msg);

Any one solution to this problem.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.