// make the actual connection // and HELO handshaking private void Connect() { Stream stream; if (use_ssl) { tcpConnection = new TcpClient( server , 465 ); stream = new SslClientStream (tcpConnection.GetStream(), server, false); } else { tcpConnection = new TcpClient( server , 25 ); stream = tcpConnection.GetStream(); } smtp = new EsmtpStream( stream ); // read the server greeting smtp.ReadResponse(); smtp.CheckForStatusCode( 220 ); // write the HELO command to the server smtp.WriteHelo( Dns.GetHostName() ); smtp.WriteAuth( username, password ); }
// make the actual connection // and HELO handshaking private void Connect() { Stream stream; if (use_ssl) { tcpConnection = new TcpClient(server, 465); stream = new SslClientStream(tcpConnection.GetStream(), server, false); } else { tcpConnection = new TcpClient(server, 25); stream = tcpConnection.GetStream(); } smtp = new EsmtpStream(stream); // read the server greeting smtp.ReadResponse(); smtp.CheckForStatusCode(220); // write the HELO command to the server smtp.WriteHelo(Dns.GetHostName()); smtp.WriteAuth(username, password); }