agronholm / agronholm/smtpproto
Multiple problems trying to send email
- Lingua principale
- Python
- Stelle
- 19
- Fork
- 3
- Metriche di merge delle PR
- Nessuna PR unita negli ultimi 30g
Descrizione
Hello! I'm testing this library in my pet project, and I'm having quite a number of problems trying to send email.
To start with, the configuration is as follows:
- host "smtp.mail.ru"
- port 465
- the server tells to use "tls/ssl"
Now, some of these problems may come from the non-standard server, but here is my story nonetheless.
First of all, the initial waiting hangs and ends after timeout: https://github.com/agronholm/smtpproto/blob/master/src/smtpproto/client.py#L82
I looked in and discovered, that connect_tcp function accepts ssl_context as argument, but it is not passed (though, the client might be instantiated with it). https://github.com/agronholm/smtpproto/blob/master/src/smtpproto/client.py#L79
So I passed `ssl.SSLContext()`, and connected. I know, that TLSWrapper is applied later, but for some reason I couldn't even pass this line to get it.
Then I failed trying to authenticate with `LoginAuthenticator`. The exception was:
```
ValueError: Unhandled question: VXNlcm5hbWU6
```
which is "Username:" when decoded. So, essentially the problem is the semicolon. I don't know, whether it's a violation of standard or not, but maybe make an additional check here? https://github.com/agronholm/smtpproto/blob/master/src/smtpproto/auth.py#L72
Like, instead for strict equality, check that `question[:8] == "username"` or something?
Also, correct me if I'm wrong, but `question` is never decoded from bytes https://github.com/agronholm/smtpproto/blob/master/src/smtpproto/auth.py#L71 So the latter checks don't make sense.
After I fix all that, I get the final nail in the coffin with
```
smtpproto.protocol.SMTPProtocolViolation: Tried to send a command before the previous one received a response
```
To be honest, I don't understand, under which circumstances this error should popup at all? Shouldn't we wait for response, before sending the next command?
----------
P.S. After all that, I tried sending a mail with standard Django smtp EmailBackend for comparison. And you know what? It hanged out completely :-) Maybe its the kind of problem, that Nathaniel Smith wrote here about `select.select`... https://vorpus.org/blog/control-c-handling-in-python-and-trio/#how-does-the-python-interpreter-pull-it-off
P.P.S. aiosmtplib implementation works without problems.
But anyway, there are definitely some questions to smtpproto as well. Could you check them out, please?
Guida per i contributori
Nessuna guida per i contributori indicizzata per questo repository
Valutazione
Questa issue non è ancora stata valutata.