I have the default mail sender set as a config variable. I use the python debuggingserver on my development box to test 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.