简体   繁体   中英

Using Flask-Mail for production

I have been putting together a website using vanilla JavaScript, HTML, Python (Flask) and SQLAlchemy

I'm using 2 linode servers. One for the website, one for the database

I contacted linode and they unblocked the email ports, and I configured gmail to allow less-secure apps.

As of right now I am using Flask-Mail and it uses my gmail username and password to log in, and everything on the website is functioning exactly how I want it to

I only use email for 3 things:

  • registration confirmation
  • recover account password
  • I would like to send emails to users who sign up with site updates, once per month at the most.

However, I've seen many people say gmail is not good for production. My main concern is that some people have said gmail will limit your outgoing correspondence to 100 people.

I really don't anticipate a high volume. If it exceeds 100 people I would be surprised tbh, but I want to be able to handle at least a couple thousand at the most.

I'd prefer not to get bogged down with changing all of the code and dealing with setting up a separate email server and all of that. If there's a solution as simple as “hey use this website and user login instead of your gmail account” that would be great.

If that's not acceptable, I understand. I'm just looking for the easiest solution that doesn't necessarily have to be amazingly scalable at the moment.

Thanks in advance!

SendGrid is a great option. Their free teir allows you to send 100 emails per day and can scale up if you do find your application is gaining momentum. Below are the setting you'd use to configure your flask app (and flask-mail) to be able to use the service. This is derived from a tutorial that SendGrid itself provides here for configuring a flask app with flask-mail.

MAIL_DEFAULT_SENDER="theemailyouwanttoshow@site.com"
MAIL_USERNAME="apikey"
MAIL_PASSWORD="SG.abcdjekfkdmd"
MAIL_SERVER="smtp.sendgrid.net"
MAIL_PORT=587
MAIL_USE_TLS=1
MAIL_USE_SSL=0

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM