gamegos / cesi

CeSI is a web interface for managing multiple supervisors from the same place.
GNU General Public License v3.0
577 stars 185 forks source link

Unable to resolve “No address associated with hostname” on azure web service #76

Open daveMitra opened 4 years ago

daveMitra commented 4 years ago

Hi, I am quite new in azure and facing issue in my deployed web app written in flask. I have built a solution using flask where, user can send mail to my company mail box. The main code written on application.py is below

from flask import Flask, render_template from flask_mail import Mail, Message

app = Flask(name) app.config.update( DEBUG=True, MAIL_SERVER='My Company SMTP MAIL SERVER', MAIL_PORT=My Company SMTP PORT NUMBER,

MAIL_USE_SSL=True,

MAIL_USERNAME='XXXXX.YYYY@mycompanyname.com',

) mail = Mail(app)

@app.route('/') def mailSend(): try: msg = Message("Send Mail Tutorial!", sender="XXXXX.YYYY@mycompanyname.com", recipients=["ZZZ.WWW@mycompanyname.com"]) msg.html = render_template('linkPage.html') mail.send(msg) return 'Mail sent!' except Exception as e: print(type(e)) print(e) return 'error'

The sender mail address is shared mail and does not need password to send any mail. I already tested the solution on my pycharm IDE and worked totally fine without any issue. However, its throwing error on azure app service after deploying over there. Its saying gaierror'> [Errno -5] No address associated with hostname

Any suggestion on this please let me know.

FYI, I didnt mention my company SMTP server name and port number for data sensitivity