gauteh / lieer

Fast email-fetching and sending and two-way tag synchronization between notmuch and GMail
http://lieer.gaute.vetsj.com
Other
492 stars 60 forks source link

Mails with large attachments sent but with error #279

Open lamons opened 1 week ago

lamons commented 1 week ago

I am using Lieer/gmi by calling it using gmi send -t -C /mail from neomutt. When I tried sending mails with large attachments (10~20MB), I get an error screen that looks like the mail sending was failed, and bumped me back to the email editor screen. But the mail had actually already been sent out at this time.

The error message I got is: ``` path: /mail sending message, from: X X .. Traceback (most recent call last): File "/opt/homebrew/bin/gmi", line 24, in g.main () File "/opt/homebrew/lib/python3.12/site-packages/lieer/gmailieer.py", line 418, in main args.func(args) File "/opt/homebrew/lib/python3.12/site-packages/lieer/gmailieer.py", line 1093, in send msg = self.remote.send(msg, threadId) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/opt/homebrew/lib/python3.12/site-packages/lieer/remote.py", line 139, in func_wrap return func(self, *args, **kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/opt/homebrew/lib/python3.12/site-packages/lieer/remote.py", line 877, in send .execute() ^^^^^^^^^ File "/opt/homebrew/lib/python3.12/site-packages/googleapiclient/_helpers.py", line 130, in positional_wrapper return wrapped(*args, **kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^ File "/opt/homebrew/lib/python3.12/site-packages/googleapiclient/http.py", line 923, in execute resp, content = _retry_request( ^^^^^^^^^^^^^^^ File "/opt/homebrew/lib/python3.12/site-packages/googleapiclient/http.py", line 222, in _retry_request raise exception File "/opt/homebrew/lib/python3.12/site-packages/googleapiclient/http.py", line 191, in _retry_request resp, content = http.request(uri, method, *args, **kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/opt/homebrew/lib/python3.12/site-packages/google_auth_httplib2.py", line 218, in request response, content = self.http.request( ^^^^^^^^^^^^^^^^^^ File "/opt/homebrew/lib/python3.12/site-packages/httplib2/__init__.py", line 1724, in request (response, content) = self._request( ^^^^^^^^^^^^^^ File "/opt/homebrew/lib/python3.12/site-packages/httplib2/__init__.py", line 1444, in _request (response, content) = self._conn_request(conn, request_uri, method, body, headers) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/opt/homebrew/lib/python3.12/site-packages/httplib2/__init__.py", line 1396, in _conn_request response = conn.getresponse() ^^^^^^^^^^^^^^^^^^ File "/opt/homebrew/Cellar/python@3.12/3.12.2_1/Frameworks/Python.framework/Versions/3.12/lib/python3.12/http/client.py", line 1423, in +getresponse response.begin() File "/opt/homebrew/Cellar/python@3.12/3.12.2_1/Frameworks/Python.framework/Versions/3.12/lib/python3.12/http/client.py", line 331, in begin version, status, reason = self._read_status() ^^^^^^^^^^^^^^^^^^^ File "/opt/homebrew/Cellar/python@3.12/3.12.2_1/Frameworks/Python.framework/Versions/3.12/lib/python3.12/http/client.py", line 292, in+_read_status line = str(self.fp.readline(_MAXLINE + 1), "iso-8859-1") ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/opt/homebrew/Cellar/python@3.12/3.12.2_1/Frameworks/Python.framework/Versions/3.12/lib/python3.12/socket.py", line 707, in readinto return self._sock.recv_into(b) ^^^^^^^^^^^^^^^^^^^^^^^ File "/opt/homebrew/Cellar/python@3.12/3.12.2_1/Frameworks/Python.framework/Versions/3.12/lib/python3.12/ssl.py", line 1252, in recv_into return self.read(nbytes, buffer) ^^^^^^^^^^^^^^^^^^^^^^^^^ File "/opt/homebrew/Cellar/python@3.12/3.12.2_1/Frameworks/Python.framework/Versions/3.12/lib/python3.12/ssl.py", line 1104, in read return self._sslobj.read(len, buffer) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ TimeoutError: The read operation timed out +_read_status line = str(self.fp.readline(_MAXLINE + 1), "iso-8859-1") ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ```

Not sure if this is a bug or some network issue on my side. Thanks!

gauteh commented 1 week ago

Looks like a network timeout. The timeout is configurable, but maybe not applied in this case. You can try to increase it and see if it helps.

-- gaute

lamons commented 1 week ago

@gauteh thanks for the tip. I tried setting the Timeout option to 0 but still got the same error. The error message end with

  File "/opt/homebrew/Cellar/python@3.12/3.12.2_1/Frameworks/Python.framework/Versions/3.12/lib/python3.12/http/client.py", line 292, in
+_read_status
    line = str(self.fp.readline(_MAXLINE + 1), "iso-8859-1")
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/homebrew/Cellar/python@3.12/3.12.2_1/Frameworks/Python.framework/Versions/3.12/lib/python3.12/socket.py", line 707, in readinto
    return self._sock.recv_into(b)
           ^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/homebrew/Cellar/python@3.12/3.12.2_1/Frameworks/Python.framework/Versions/3.12/lib/python3.12/ssl.py", line 1252, in recv_into
    return self.read(nbytes, buffer)
           ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/homebrew/Cellar/python@3.12/3.12.2_1/Frameworks/Python.framework/Versions/3.12/lib/python3.12/ssl.py", line 1104, in read
    return self._sslobj.read(len, buffer)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
TimeoutError: The read operation timed out

Well despite the error, I can still send these emails, so I guess it's not something fatal...

gauteh commented 1 week ago

Ok. Maybe there is somewhere else where the timeout (an environment variable for SSL or something) can be configured. It is frequently set to 10 minutes.

Good that it still works though.. Do you manage to download the message later?

lamons commented 1 week ago

Thanks, I will try if I can find any other config that might be relevant. Though the error occurs much shorter than 10 minutes, I tested and counted, it pops up around 1 minutes after I hit send mail.

Do you manage to download the message later?

Yes, I can download the mail after the next gmi sync, like it is not sent from my neomutt.