Send Email Test fails with Gmail OAuth

[EFAULT] Failed to send email: [Errno 110] Connection timed out

MORE INFO:
Error: Traceback (most recent call last):
File “/usr/lib/python3/dist-packages/middlewared/plugins/mail.py”, line 368, in send_raw
self.middleware.call_sync(‘mail.gmail_send’, msg, config)
File “/usr/lib/python3/dist-packages/middlewared/main.py”, line 1036, in call_sync
return methodobj(*prepared_call.args)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File “/usr/lib/python3/dist-packages/middlewared/plugins/mail_/gmail.py”, line 82, in gmail_send
}).execute()
^^^^^^^^^
File “/usr/lib/python3/dist-packages/googleapiclient/_helpers.py”, line 130, in positional_wrapper
return wrapped(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^
File “/usr/lib/python3/dist-packages/googleapiclient/http.py”, line 923, in execute
resp, content = _retry_request(
^^^^^^^^^^^^^^^
File “/usr/lib/python3/dist-packages/googleapiclient/http.py”, line 222, in _retry_request
raise exception
File “/usr/lib/python3/dist-packages/googleapiclient/http.py”, line 191, in _retry_request
resp, content = http.request(uri, method, *args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File “/usr/lib/python3/dist-packages/google_auth_httplib2.py”, line 209, in request
self.credentials.before_request(self._request, method, uri, request_headers)
File “/usr/lib/python3/dist-packages/google/auth/credentials.py”, line 239, in before_request
self._blocking_refresh(request)
File “/usr/lib/python3/dist-packages/google/auth/credentials.py”, line 202, in _blocking_refresh
self.refresh(request)
File “/usr/lib/python3/dist-packages/google/oauth2/credentials.py”, line 409, in refresh
) = reauth.refresh_grant(
^^^^^^^^^^^^^^^^^^^^^
File “/usr/lib/python3/dist-packages/google/oauth2/reauth.py”, line 333, in refresh_grant
response_status_ok, response_data, retryable_error = _client._token_endpoint_request_no_throw(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File “/usr/lib/python3/dist-packages/google/oauth2/_client.py”, line 191, in _token_endpoint_request_no_throw
response = request(
^^^^^^^^
File “/usr/lib/python3/dist-packages/google_auth_httplib2.py”, line 119, in call
response, data = self.http.request(
^^^^^^^^^^^^^^^^^^
File “/usr/lib/python3/dist-packages/httplib2/init.py”, line 1701, in request
(response, content) = self._request(
^^^^^^^^^^^^^^
File “/usr/lib/python3/dist-packages/httplib2/init.py”, line 1421, in _request
(response, content) = self._conn_request(conn, request_uri, method, body, headers)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File “/usr/lib/python3/dist-packages/httplib2/init.py”, line 1343, in _conn_request
conn.connect()
File “/usr/lib/python3/dist-packages/httplib2/init.py”, line 1133, in connect
sock.connect((self.host, self.port))
TimeoutError: [Errno 110] Connection timed out

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File “/usr/lib/python3/dist-packages/middlewared/job.py”, line 515, in run
await self.future
File “/usr/lib/python3/dist-packages/middlewared/job.py”, line 562, in __run_body
rv = await self.middleware.run_in_thread(self.method, *args)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File “/usr/lib/python3/dist-packages/middlewared/main.py”, line 622, in run_in_thread
return await self.run_in_executor(io_thread_pool_executor, method, *args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File “/usr/lib/python3/dist-packages/middlewared/main.py”, line 619, in run_in_executor
return await loop.run_in_executor(pool, functools.partial(method, *args, **kwargs))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File “/usr/lib/python3.11/concurrent/futures/thread.py”, line 58, in run
result = self.fn(*self.args, **self.kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File “/usr/lib/python3/dist-packages/middlewared/schema/processor.py”, line 178, in nf
return func(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^
File “/usr/lib/python3/dist-packages/middlewared/schema/processor.py”, line 52, in nf
res = f(*args, **kwargs)
^^^^^^^^^^^^^^^^^^
File “/usr/lib/python3/dist-packages/middlewared/plugins/mail.py”, line 261, in send
return self.send_raw(job, message, config)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File “/usr/lib/python3/dist-packages/middlewared/schema/processor.py”, line 178, in nf
return func(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^
File “/usr/lib/python3/dist-packages/middlewared/plugins/mail.py”, line 395, in send_raw
raise CallError(f’Failed to send email: {e}')
middlewared.service_exception.CallError: [EFAULT] Failed to send email: [Errno 110] Connection timed out

You shpuld tell us the version of Truenas you are using, or maybe I missed it.

Agree with Joe. But the error message seems pretty clear: there was a timeout connecting to the mail server you specified. Make sure you’ve entered the right hostname, port, you don’t have any kind of firewall blocking those connections, etc.

If that doesn’t fix it, in addition to the TrueNAS version, details of how you’ve configured the email alerts would be helpful.

If you mean core or scale I’m using scale, if there is a different version ID I’m missing please tell me.

I have a OPNsense firewall, but I didn’t enter any ports, I used Gmail OAuth.

…and configured it how? Details, please. None of us has a working crystal ball.

The version number?

2 Likes


Version: Current Train: TrueNAS-SCALE-Fangtooth - TrueNAS SCALE Fangtooth 25.04 [release]

Seems odd to me that you setup without issue the oauth, but the email send fails with a connection timeout. Can you reach gmail.googleapis.com? Should be the end point used for send emails

I’m confused on what you mean by this, can you guide me, I’m new to TrueNAS.

Don’t worry, open the shell and try this simple command ping gmail.googleapis.com

I tried to ping it, but it get’s stuck at the start of the process.

As the same can you try nslookup gmail.googleapis.com?

That worked, it gave out this:

IMHO if curl gmail.googleapis.com fails as the ping command, something Is blocking your Nas to comunicate with Google services.

Curl did fail… But so did my Windows PC that can ping that address.

Odd… Last check that come into my mind: traceroute gmail.googleapis.com, but i don’t think will work (at least on TN).

Quite the other way around, it worked on TrueNAS, but Windows 11 didn’t recognize the command. I tried pinging my personal (Wix) website on TrueNAS, and it worked, so well in fact it wouldn’t stop until Ctrl+C.

Which is exactly how ping is supposed to work on every sane OS.

Under Windows it would likely be tracert instead.

:rofl:

That worked.

I also tried to ping just google.ca, and it got stuck again, my Windows PC could ping it though.