Questions tagged [flask-mail]

The Flask-Mail extension provides a simple interface to set up SMTP with your Flask application and to send messages from your views and scripts.

The Flask-Mail extension provides a simple interface to set up SMTP with your Flask application and to send messages from your views and scripts.

249 questions
2
votes
1 answer

flask_mail seems to be imported in pythonanywhere, but when running get error code: no module named

I am trying to send a pandas DataFrame in an email through flask_mail: from flask import Flask, redirect, render_template, request, url_for, jsonify, session from flask_mail import Mail, Message app.config['MAIL_SERVER'] =…
Arno Claes
  • 167
  • 11
2
votes
0 answers

nginx/gunicorn/flask server timed out only when using flask-mail

I've created an app using flask on python3 and deployed it using nginx and gunicorn on Ubuntu 18.04. Everything worked fine (locally and on the server) until I set up mail support using flask-mail. On the local flask development server everything…
bliepp
  • 21
  • 2
2
votes
0 answers

How to fix OSError: [Errno 0] on Python Flask and Flask-Mail

I am setting up a Python Flask-Mail configuration using smtp.gmail.com, I followed the instructions correctly, but I keep getting the OSError [Errno 0]. I am using the Windows Subsystem for Linux, I downloaded both Python 2 and Python 3 into the…
JHero23
  • 149
  • 3
  • 10
2
votes
1 answer

Circular import issue when working with sending mail upon user registration on Flask

I am currently working with a flask application and am trying to send out emails once the user has registered with the site. I am having difficulties with circular imports between the main.py where the app is instantiated and the data_inserts.py…
lordlabakdas
  • 1,163
  • 5
  • 18
  • 33
2
votes
0 answers

flask handle thread exceptions

I'm trying to display an error if there is an exception in my asynchronous send_email function but even after an exception is occurred in the background thread the data still gets stored in the database. The except block never gets executed. I'm…
Leon N
  • 184
  • 2
  • 24
2
votes
1 answer

cannot send email with flask-mail

I am trying to send Email with Flask-Mail, This is the link of tutorial: https://www.twilio.com/blog/2018/03/send-email-programmatically-with-gmail-python-and-flask.html EMAIL_USER and EMAIL_PASSWORD are environment variables, so I try to modify…
HungryBird
  • 1,077
  • 1
  • 11
  • 28
2
votes
0 answers

Flask mail emails delayed on not sent to some domains

I am building a Flask app, and while developing, I configured Flask-Mail to send emails through a Gmail account on port 25. With that configuration, I am able to send emails to other Gmail accounts without a problem. However, when I switch the…
dtrodger
  • 31
  • 2
2
votes
3 answers

Sending mail using flask + blueprint

I have a question about the structure of blueprint My flask structure looks like app/ main/ __init__.py mail.py __init.py manage.py config.py I register blueprint in __init__.py, for app/__init__.py from flask_mail import…
Tony Chou
  • 584
  • 1
  • 9
  • 26
2
votes
1 answer

ImportError: cannot import name 'app' with Flask

I have an issue with the configuration of Flask-Mail. Here is my directory structure: ▾ app/ ▾ controllers/ __init__.py mail.py ▾ config/ __init__.py ▾ run.py In my run.py i have: from app import app if __name__ == '__main__': …
Xavier
  • 3,919
  • 3
  • 27
  • 55
2
votes
1 answer

Email confirmation in Flask fails

The below code successfully generates a token and sends a link to the user's inbox for confirmation. But when the user clicks on it, Flask is not recognizing the token it just created. Here is the error message: "Got exception from ts.loads: 404…
okcapp
  • 405
  • 1
  • 4
  • 15
2
votes
2 answers

Flask - cannot use Flask and Flask-mail instances from other files

I'm currently building an application with Flask. I'm struggling to access Flask instance 'app' as well as Flask-mail instance 'mail'. Below is how my project looks like: └── my-project ├── application │ ├── __init__.py │ ├── admin …
user7924113
  • 169
  • 1
  • 3
  • 15
2
votes
0 answers

Flask-Mail Recursion Error when attaching file to email

When I try to attach a file to an email message with Flask-Mail, I get a RecursionError. The code works fine when not attaching files. How do I fix this? import mimetypes def send_message(to, subject, message, attachment_path=None): msg =…
2
votes
3 answers

flask_mail Message instance is not JSON serializable

I am trying to run this very simple flask/celery app: @celery.task def send_async_email(msg): with app.app_context(): mail.send(msg) @celery.task(bind=True) @app.route('/', methods=['GET', 'POST']) def…
Velopachi
  • 21
  • 3
2
votes
3 answers

Flask-Mail times out trying to connect to Gmail

I have very small flask app which send emails using flask-mail but when I run it nothing happen no errors no exceptions nothing! this is the code from flask import Flask from flask_mail import Mail, Message app = Flask(__name__) DEBUG =…
Ali Faki
  • 3,928
  • 3
  • 17
  • 25
2
votes
1 answer

IO Error - Flask-mail and running server with proxy

I'm with a very very wierd bug... I have a flask app using flask-mail to send email messages. In a RedHat Server, I tryied using runserver (flask-manager) and gunicorn. So I have a apache server connecting to this app using Proxy. When I run the…
mariomol
  • 667
  • 1
  • 7
  • 15