I am trying to write a C# code to send mail automatically (without using System.Web.Mail object) //this is to START TLS stdOut.WriteLine("STARTTLS"); stdOut.Flush(); responseCode = GetResponse(stdIn); < stdOut.WriteLine("MAIL FROM:"); stdOut.Flush(); responseCode = GetResponse(stdIn); But it is giving error because responseCode is 0 I am not able to figure out the problem One more thing is I am using My ISP's outgoing mail server for the same. If I don't issue STARTTLS command it throws exception as 'Must issue STARTTLS command. Thanks in advance!!