SMTPServerDisconnected: please run connect() first

前端 未结 1 1340
难免孤独
难免孤独 2021-01-21 23:46

I\'m exploring flask and attempting to setup a simple web app with secure registration and sign in. I\'m using flask-security to do this. Unfortunately, when I navigate to the s

1条回答
  •  北荒
    北荒 (楼主)
    2021-01-22 00:17

    Alright, so I figured out what the problem was. By default flask-security is set up to send mail as "localhost". My mail provider is Zoho, but I'm just using them as a mail server for a domain I run. My mail settings are such that I can only send mail from certain addresses. Because 'localhost' is not one of these flask-security was not able to connect to Zoho's servers.

    So the solution was to add to my config file the line

    SECURITY_EMAIL_SENDER = 'valid_email@my_domain.com'
    

    Hopefully this will save someone else some time trying to figure out why flask-security's email isn't working.

    0 讨论(0)
提交回复
热议问题