Tlaloc-ES
Tlaloc-ES

Reputation: 5282

Name or service not known when try to send email with flask-mail

Hello I have the following configuration in the thunderbird:

enter image description here

And I set this configuration inside app with:

app.config["MAIL_SERVER"] = "smtp....."
app.config["MAIL_PORT"] = 587
app.config["MAIL_USERNAME"] = "info@...."
app.config["MAIL_PASSWORD"] = "pasword"
app.config["MAIL_USE_TLS"] = True
app.config["MAIL_USE_SSL"] = False

but when I try to send an email with

from flask_mail import Message, Mail

mail = Mail(app)

msg = Message(
    "Hello", sender="info@....", recipients=["[email protected]"]
)
try:
    mail.send(msg)
except Exception as e:
    print("---------")
    print(e)

I got the following error:

[Errno -2] Name or service not known

how can I solve it?

Thanks

Upvotes: 0

Views: 431

Answers (1)

Tlaloc-ES
Tlaloc-ES

Reputation: 5282

The app.config["MAIL_SERVER"] configuration was wrong.

Upvotes: 1

Related Questions