title: How to send email attachments with Python 3.6
body: <p>would you mind helping me, please!
  I use all code's from this page <a href="https://stackoverflow.com/questions/3362600/how-to-send-email-attachments-with-python">How to send email attachments with Python</a></p>
  
  <p>but it didn't work =(</p>
  
  <p>This is last version which i used</p>
  
  <pre><code>import smtplib
  from smtplib import SMTP_SSL
  from email.mime.multipart import MIMEMultipart
  from email.mime.base import MIMEBase
  from email.mime.text import MIMEText
  from email import encoders
  import os
  
  filepath = 'D:/files/1.jpg'
  fromaddr = "name@gmail.com"
  toaddr = "name2@gmail.com"
  password = '********'
  mail_adr = 'smtp.gmail.com'
  mail_port = 587
  
  # Compose attachment
  part = MIMEBase('application', "octet-stream")
  part.set_payload(open(filepath, "rb").read())
  encoders.encode_base64(part)
  part.add_header('Content-Disposition', "attachment; filename= %s" % os.path.basename(filepath))
  
  # Compose message
  msg = MIMEMultipart()
  msg['From'] = fromaddr
  msg['To'] = toaddr
  msg.attach(part)
  
  # Send mail
  smtp = SMTP_SSL()
  smtp.set_debuglevel(1)
  smtp.connect(mail_adr, mail_port)
  smtp.login(fromaddr, password)
  smtp.sendmail(fromaddr, toaddr, msg.as_string())
  smtp.quit()
  </code></pre>
  
  <p>and here are the errors I fall</p>
  
  <pre><code>connect: ('smtp.gmail.com', 587)
  connect: ('smtp.gmail.com', 587)
  Traceback (most recent call last):
    File "C:/Users/Oleg/Desktop/444.py", line 31, in &lt;module&gt;
      smtp.connect(mail_adr, mail_port)
    File "C:\Users\Oleg\AppData\Local\Programs\Python\Python36-32\lib\smtplib.py", line 335, in connect
      self.sock = self._get_socket(host, port, self.timeout)
    File "C:\Users\Oleg\AppData\Local\Programs\Python\Python36-32\lib\smtplib.py", line 1037, in _get_socket
      server_hostname=self._host)
    File "C:\Users\Oleg\AppData\Local\Programs\Python\Python36-32\lib\ssl.py", line 401, in wrap_socket
      _context=self, _session=session)
    File "C:\Users\Oleg\AppData\Local\Programs\Python\Python36-32\lib\ssl.py", line 808, in __init__
      self.do_handshake()
    File "C:\Users\Oleg\AppData\Local\Programs\Python\Python36-32\lib\ssl.py", line 1061, in do_handshake
      self._sslobj.do_handshake()
    File "C:\Users\Oleg\AppData\Local\Programs\Python\Python36-32\lib\ssl.py", line 683, in do_handshake
      self._sslobj.do_handshake()
  ssl.SSLError: [SSL: UNKNOWN_PROTOCOL] unknown protocol (_ssl.c:749)
  </code></pre>