title: Flask Security's Flask Mail registration receives smtplib.SMTPAuthenticationError from smtp.gmail.com
body: <p>I have a flask app using Flask-Security's registration to send Flask Mail upon registration. I've pointed the flask mail config at smtp.gmail.com port 464 using SSL. However, when the app tries to send mail it gets an smtplib.SMTPAuthenticationError. If I go to the <a href="https://www.google.com/settings/u/1/security/lesssecureapps" rel="nofollow noreferrer">google admin page</a> and allow "less secure apps" through then the send works.</p>
  
  <p>Here is the stack trace that I get when the send fails with the aforementioned error:</p>
  
  <pre><code>File "~/lib/python3.5/site-packages/flask/app.py", line 1836, in __call__
    return self.wsgi_app(environ, start_response)
  File "~/lib/python3.5/site-packages/flask/app.py", line 1820, in wsgi_app
    response = self.make_response(self.handle_exception(e))
  File "~/lib/python3.5/site-packages/flask_restful/__init__.py", line 271, in error_router
    return original_handler(e)
  File "~/lib/python3.5/site-packages/flask/app.py", line 1403, in handle_exception
    reraise(exc_type, exc_value, tb)
  File "~/lib/python3.5/site-packages/flask/_compat.py", line 33, in reraise
    raise value
  File "~/lib/python3.5/site-packages/flask/app.py", line 1817, in wsgi_app
    response = self.full_dispatch_request()
  File "~/lib/python3.5/site-packages/flask/app.py", line 1477, in full_dispatch_request
    rv = self.handle_user_exception(e)
  File "~/lib/python3.5/site-packages/flask_restful/__init__.py", line 271, in error_router
    return original_handler(e)
  File "~/lib/python3.5/site-packages/flask/app.py", line 1381, in handle_user_exception
    reraise(exc_type, exc_value, tb)
  File "~/lib/python3.5/site-packages/flask/_compat.py", line 33, in reraise
    raise value
  File "~/lib/python3.5/site-packages/flask/app.py", line 1475, in full_dispatch_request
    rv = self.dispatch_request()
  File "~/lib/python3.5/site-packages/flask/app.py", line 1461, in dispatch_request
    return self.view_functions[rule.endpoint](**req.view_args)
  File "~/lib/python3.5/site-packages/flask_security/decorators.py", line 225, in wrapper
    return f(*args, **kwargs)
  File "~/lib/python3.5/site-packages/flask_security/views.py", line 117, in register
    user = register_user(**form.to_dict())
  File "~/lib/python3.5/site-packages/flask_security/registerable.py", line 41, in register_user
    user=user, confirmation_link=confirmation_link)
  File "~/lib/python3.5/site-packages/flask_security/utils.py", line 341, in send_mail
    mail.send(msg)
  File "~/lib/python3.5/site-packages/flask_mail.py", line 491, in send
    with self.connect() as connection:
  File "~/lib/python3.5/site-packages/flask_mail.py", line 144, in __enter__
    self.host = self.configure_host()
  File "~/lib/python3.5/site-packages/flask_mail.py", line 165, in configure_host
    host.login(self.mail.username, self.mail.password)
  File "/usr/local/Cellar/python3/3.5.1/Frameworks/Python.framework/Versions/3.5/lib/python3.5/smtplib.py", line 729, in login
    raise last_exception
  File "/usr/local/Cellar/python3/3.5.1/Frameworks/Python.framework/Versions/3.5/lib/python3.5/smtplib.py", line 720, in login
    initial_response_ok=initial_response_ok)
  File "/usr/local/Cellar/python3/3.5.1/Frameworks/Python.framework/Versions/3.5/lib/python3.5/smtplib.py", line 641, in auth
    raise SMTPAuthenticationError(code, resp)
  </code></pre>
  
  <p>My mail config is:</p>
  
  <pre><code>app.config['MAIL_SERVER'] = 'smtp.gmail.com'
  app.config['MAIL_PORT'] = 465
  app.config['MAIL_USE_SSL'] = True
  </code></pre>
  
  <p>This is what happens when I goto google admin to enable TLS for my app:</p>
  
  <p><a href="https://i.stack.imgur.com/r4HrM.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/r4HrM.png" alt="Not available for your account"></a></p>
  
  <p>What do I have to do to tell Flask Mail to comply with google's security standard?</p>