title: If I open smtp server through a web browser
body: <p>I am studying about smtp, http and various application layer protocols. I was wondering what will happen when I type smtp.gmail.com (or any other mail server) in my web browser.</p>
  
  <p>For me, it says it waits for a long time and then show Internal Server Error. It does not show error like No Page Found. Why is that?</p>
  
  <p>As far as I understand, smtp.gmail.com won't return an html page, so web browser should throw an error. Also how does my browser know which port to connect? SMTP servers use different port than HTTP servers, I guess. So ...</p>
  
  <p>What exactly is happening when I connect to smtp.gmail.com?</p>
  
  <p><strong>EDIT:</strong></p>
  
  <p>It gives <code>502</code> status code which means <code>The server was acting as a gateway or proxy and received an invalid response from the upstream server</code>. I don't understand this. 
  The web browser should not connect to <code>smtp.gmail.com</code> in the first place as it listens on a different port than 80. So it should give <code>404 Not Found</code> error. So what exactly is happening?</p>