title: Python logging.SMTP handler is not working
body: <p>What I am trying to do is create a separate logger that will send error logs via email.
  However, every time I call the  <em>email_logger.error('...')</em>, the following error occurs:</p>
  
  <blockquote>
    <p>smtplib.SMTPNotSupportedError: SMTP AUTH extension not supported by server.</p>
  </blockquote>
  
  <p>The code I am using is displayed bellow:</p>
  
  <pre><code>logging.basicConfig(level=logging.INFO, format='%(asctime)s :: %(funcName)s :: %(levelname)s :: %(message)s')
  
  email_logger = logging.getLogger(__name__)
  email_logger.setLevel(logging.WARNING)
  
  with smtplib.SMTP('smtp.gmail.com', 587) as server:
      server.ehlo()
      server.starttls()
      server.ehlo()
      server.login('host_email@gmail.com', r'thisismypassword')
      smtp_handler = logging.handlers.SMTPHandler(mailhost=('smtp.gmail.com', 587),
                                                  fromaddr='host_email@gmail.com',
                                                  toaddrs=['mymail@gmail.com'],
                                                  subject='A dashing subject',
                                                  credentials=('host_email@gmail.com',
                                                               r'thisismypassword'),
                                                  secure=None)
      formatter = logging.Formatter('%(asctime)s : %(funcName)s : %(levelname)s : %(name)s : %(message)s')
      smtp_handler.setFormatter(formatter)
      email_logger.addHandler(smtp_handler)
  </code></pre>