Multi Email App¶
create_app()
application factory patternCreate multi_email_app.py¶
Create ~/dev/example/multi_email_app.py with the content below.
Make sure to adjust the MAIL_*
settings below to the correct SMTP server and SMTP account settings.
Highlighted code shows what was added to the Basic App.
!! This recipe requires Flask-User v0.5.1 or up !! Please upgrade earlier versions.
User
model (username, password, etc)UserEmail
model (user_id, email, is_confirmed, is_primary, etc)SQLAlchemyAdapter()
/user/manage-emails
as an authenticated user.Run the Multi Email App¶
Run the Multi Email App with the following command:
cd ~/dev/example
python multi_email_app.py
And point your browser to http://localhost:5000
.
If you receive an SendEmailError message, or if the Registration form does not respond quickly then you may have specified incorrect SMTP settings.
If you receive a ‘AssertionError: No sender address has been set’ error, you may be using an old version of Flask-Mail which uses DEFAULT_MAIL_SENDER instead of MAIL_DEFAULT_SENDER.
If you receive a SQLAlchemy error message, delete the multi_email_app.sqlite file and restart the app. You may be using an old DB schema in that file.