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

Lack of timeout on send #114

Open
shipperizer opened this issue Jul 9, 2015 · 3 comments
Open

Lack of timeout on send #114

shipperizer opened this issue Jul 9, 2015 · 3 comments

Comments

@shipperizer
Copy link

Not sure it's a major issue and maybe not even a minor,
but let's say that the configuration is the following

    MAIL_SERVER: smtp.gmail.com
    MAIL_USE_TLS: False
    MAIL_USE_SSL: False
    MAIL_PORT: 666
    MAIL_USERNAME: [email protected]
    MAIL_PASSWORD: xxxxxxxxxxxxxxxxxxxxxxxxxx 

and all the settings are basically wrong as the email is non existent and the password as well, the port is a random one.
What happens is that when I try to send a Message, the server hangs for 4m and 20s, and it's really stuck.
As you can see below, the POST logging is delayed of that amount of time (and it's basically when I create the message, POST the form, create the Message and send it)

127.0.0.1 - - [09/Jul/2015 13:04:20] "GET /register HTTP/1.1" 200 -
127.0.0.1 - - [09/Jul/2015 13:08:41] "POST /register HTTP/1.1" 500 -
127.0.0.1 - - [09/Jul/2015 13:08:42] "GET /home HTTP/1.1" 200 -
127.0.0.1 - - [09/Jul/2015 13:08:42] "GET /home HTTP/1.1" 200 -

Would it be possible to configure a timeout of e.g 20sec after which you simply return with an error?

@kblomqvist
Copy link

Workaround is to set default socket timeout

import socket
socket.setdefaulttimeout(20)

Though it would be nice to be able to set this via API, e.g.

mail.send(msg, timeout=20)

@kblomqvist
Copy link

mail.send(msg, timeout=20)

This was not possible because, e.g. socket.SMTP class takes timeout on instantiation.

@kblomqvist
Copy link

FYI. I found out that flask-emails has support for timeout.

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

No branches or pull requests

2 participants