Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
daveMitra opened this issue Jun 10, 2020 · 0 comments

Comments

@daveMitra
Copy link

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='[email protected]',
)
mail = Mail(app)

@app.route('/')
def mailSend():
try:
msg = Message("Send Mail Tutorial!",
sender="[email protected]",
recipients=["[email protected]"])
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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants
@daveMitra and others