title: smptlib.SMTP throws an error while using 'localhost',why does it happen?
body: <p>I was just trying to learn how to send emails using the email module and smtplib. This is what I'm getting.</p>
  <pre><code>[GCC 8.4.0] on linux
  Type &quot;help&quot;, &quot;copyright&quot;, &quot;credits&quot; or &quot;license&quot; for more information.
  &gt;&gt;&gt; import smtplib
  &gt;&gt;&gt; from email.message import EmailMessage
  &gt;&gt;&gt; with open(&quot;file.txt&quot;) as fp:
  ...     msg = EmailMessage()
  ...     msg.set_content(fp.read())
  ... 
  &gt;&gt;&gt; msg['Subject'] = f'The contents of file'
  &gt;&gt;&gt; msg['From'] = &quot;s*i*a*d*1*@gmail.com&quot;
  &gt;&gt;&gt; msg['To'] = &quot;s*i*a*k*9*@gmail.com&quot;
  &gt;&gt;&gt; s = smtplib.STMP('localhost')
  Traceback (most recent call last):
    File &quot;&lt;stdin&gt;&quot;, line 1, in &lt;module&gt;
  AttributeError: module 'smtplib' has no attribute 'STMP'
  &gt;&gt;&gt; s = smtplib.SMTP('localhost')
  Traceback (most recent call last):
    File &quot;&lt;stdin&gt;&quot;, line 1, in &lt;module&gt;
    File &quot;/usr/lib/python3.6/smtplib.py&quot;, line 251, in __init__
      (code, msg) = self.connect(host, port)
    File &quot;/usr/lib/python3.6/smtplib.py&quot;, line 336, in connect
      self.sock = self._get_socket(host, port, self.timeout)
    File &quot;/usr/lib/python3.6/smtplib.py&quot;, line 307, in _get_socket
      self.source_address)
    File &quot;/usr/lib/python3.6/socket.py&quot;, line 724, in create_connection
      raise err
    File &quot;/usr/lib/python3.6/socket.py&quot;, line 713, in create_connection
      sock.connect(sa)
  ConnectionRefusedError: [Errno 111] Connection refused
  
  </code></pre>
  <p>I want to host it using localhost and it throws this error. Can anyone tell me how to solve it, please?</p>