flask-mail icon indicating copy to clipboard operation
flask-mail copied to clipboard

DEFAULT_MAIL_SENDER not seen

Open sliptonic opened this issue 10 years ago • 7 comments

I have the default mail sender set as a config variable. I use the python debuggingserver on my development box, and Sendmail on the server.

I'm sending email from a celery task. If I call the procedures directly without using celery, everything works fine. If I use celery, it errors out because it doesn't see DEFAULT_MAIL_SENDER. I work around it by including this line: msg.sender = mail.app.config['DEFAULT_MAIL_SENDER'] Strangely, when I run it on the server, it works fine, even when called from a celery task.

sliptonic avatar May 21 '14 15:05 sliptonic

This is probably due to Celery not having the Flask context (also you aren't in a request context). This is probably why it works when you run it on the server or directly, but when it's ran in celery mail.app.config isn't setup.

jamesonjlee avatar Aug 06 '14 19:08 jamesonjlee

The config variable DEFAULT_MAIL_SENDER has been renamed to MAIL_DEFAULT_SENDER. See https://github.com/mattupstate/flask-mail/blob/master/flask_mail.py#L505. I've run into a similar problem as the documentation is not up to date.

paveldedik avatar Aug 07 '14 13:08 paveldedik

@paveldedik that's because that's the old docs! We are trying to get that to redirect to Flask-Mail

and that might be the issue :|

jamesonjlee avatar Aug 07 '14 20:08 jamesonjlee

@jamesonjlee Yes, you are absolutely right. Sorry, I didn't realize that. Unfortunately, first result on google search leads to the old docs.

paveldedik avatar Aug 08 '14 06:08 paveldedik

@paveldedik yep, we are trying to remedy that :(

jamesonjlee avatar Aug 08 '14 22:08 jamesonjlee

I don't know if the doc issue is solved, but it seems that bug can be closed.

JocelynDelalande avatar Apr 30 '15 14:04 JocelynDelalande

Looks like the doc issue is still there. It took me a while to find this thread and was so confused because I was following the old documentation and couldn't find anything else.

carlkhenderson avatar May 06 '19 17:05 carlkhenderson