0

I'm currently getting SMTPAuthenticationError: (535, '5.7.0 Invalid login or password') error. I'm trying to send a email to a user upon registering their account. but when I test this feature I keep getting this error. I made sure my gmail account information were correct aswell. I'm following up with this tutorial https://realpython.com/blog/python/handling-email-confirmation-in-flask/#add-email-confirmation

class BaseConfig(object):
    """Base configuration."""

    # main config
    SECRET_KEY = 'my_precious'
    SECURITY_PASSWORD_SALT = 'my_precious_two'
    DEBUG = False
    BCRYPT_LOG_ROUNDS = 13
    WTF_CSRF_ENABLED = True
    DEBUG_TB_ENABLED = False
    DEBUG_TB_INTERCEPT_REDIRECTS = False

    # mail settings
    # defaults are:
    #  - MAIL_SERVER = 'smtp.googlemail.com'
    #  - MAIL_PORT = 465
    #  - MAIL_USE_TLS = False
    #  - MAIL_USE_SSL = True
    MAIL_SERVER = os.environ.get('APP_MAIL_SERVER', 'smtp.googlemail.com')
    MAIL_PORT = int(os.environ.get('APP_MAIL_PORT', 465))
    MAIL_USE_TLS = _get_bool_env_var('APP_MAIL_USE_TLS', False)
    MAIL_USE_SSL = _get_bool_env_var('APP_MAIL_USE_SSL', True)

    # mail authentication
    MAIL_USERNAME = os.environ.get('APP_MAIL_USERNAME', None)
    MAIL_PASSWORD = os.environ.get('APP_MAIL_PASSWORD', None)

    # mail accounts
    MAIL_DEFAULT_SENDER = 'dahalbiplovechs@gmail.com'

I've made sure MAIL_SERVER and my account information are all accurate and have refferred back to another similar post no luck for the fix

Benji
  • 137
  • 3
  • 15
  • follow the instructions here https://support.google.com/accounts/answer/6010255?hl=en to enable unsecure app access to your gmail account (as an aside i would recommend making a dedicated gmail account just for this ... ) – Joran Beasley Sep 08 '16 at 20:57
  • @JoranBeasley I already made it so it supports less secure app but the error still persists. – Benji Sep 08 '16 at 21:01
  • then that makes me assume your password is incorrect ... make sure you use the password(key?) that is generated for insecure app access (it looks like a big hex string afaik) – Joran Beasley Sep 08 '16 at 21:02
  • That's exactly why I'm asking for help. I can't figure why it isn't working for me. I tried nearly everything. Nothing seem to be working. I tried my gmail email/pass. Doesn't work still. – Benji Sep 08 '16 at 21:03
  • @JoranBeasley Hmmm. So you use the password that gmail generates for you or your actual gmail account password? – Benji Sep 08 '16 at 21:03
  • do not use the normal password associated with your gmail account .... use the big hex password the insecure app registration page creates – Joran Beasley Sep 08 '16 at 21:03
  • @JoranBeasley If you could redirect me to the URL that gives me password for insecure apps, that'd be really helpful! – Benji Sep 08 '16 at 21:04
  • ahh shoot ... it looks like they changed how it works since the last time i did this ... let me experiment for a minute – Joran Beasley Sep 08 '16 at 21:07
  • @JoranBeasley OK. Thanks! – Benji Sep 08 '16 at 21:08

0 Answers0