相关文章推荐
爱热闹的沙发  ·  Update non-Store ...·  1 周前    · 
留胡子的电影票  ·  Use a web app ...·  3 月前    · 
威武的单杠  ·  Bearer was not ...·  4 月前    · 
有腹肌的黄花菜  ·  "Attributeerror: ...·  6 月前    · 
坏坏的麦片  ·  How to fix OSError: ...·  11 月前    · 
着急的冰淇淋  ·  electron ...·  9 月前    · 
很拉风的猕猴桃  ·  [sql ...·  1 年前    · 

i have created a new azure web app and deployed the below mentioned flask code to the app using azure cli command from my local computer. Right now, while running the app its throwing error that "ModuleNotFoundError: No module named 'flask_mail'"
I already installed requirement.txt and flask-mail is also mentioned over there. any idea why its showing now ?

 from flask import Flask, render_template
 from flask_mail import Mail, Message
  app = Flask(__name__)
  app.config.update(
      DEBUG=True,
      MAIL_SERVER='COMPANY SMTP SERVER NAME',
      MAIL_PORT=25,
      MAIL_USERNAME='XXXXXX@ge.com'
  mail = Mail(app)
  @app.route('/')
  def mailSend():
          msg = Message("Send Mail Tutorial!",
                        sender="XXXXXX@ge.com",
                        recipients=["YYYYY@ge.com"])
          msg.html = render_template('thankyou.html')
          mail.send(msg)
          return 'Mail sent!'
      except Exception as e:
          print(type(e))
          print(e)
          return 'error'

@ryanchill if you have any suggestion please let me know.

FYI, I already deployed this code before as well to another web app and that time though it didn't send any mail but it didnt throw any error like this.

Hi @MITRADebarthaGECoreTechCyber-2843,

According to https://pythonhosted.org/flask-mail/, I don't believe flask_mail is an available module in the Mail package. Hope that helps.

 from flask import Flask
 from flaskext.mail import Mail
 app = Flask(__name__)
 mail = Mail(app)

Regards,