[GH-ISSUE #48] Error closing the mail server connection #5882

Closed
opened 2026-04-20 16:17:26 -05:00 by GiteaMirror · 7 comments
Owner

Originally created by @zero-thermo on GitHub (Sep 21, 2022).
Original GitHub issue: https://github.com/go-vikunja/vikunja/issues/48

Frontend v0.19.1 + API v0.19.2 setup via docker-compose.

Emails are successfully sent and received, but with the following error in the API logs (and via ./vikunja testmail):

ERROR	▶ mail/func1 1bd Error closing the mail server connection: not connected to SMTP server

Bug or WAI?

Used the following variables to enable email in docker-compose.yaml:

      VIKUNJA_SERVICE_ENABLEEMAILREMINDERS: 1
      VIKUNJA_MAILER_ENABLED: 1
      VIKUNJA_MAILER_FORCESSL: 1
      VIKUNJA_MAILER_HOST: <my smtp server>
      VIKUNJA_MAILER_PORT: 587
      VIKUNJA_MAILER_USERNAME: <my username>
      VIKUNJA_MAILER_PASSWORD: <my password>
      VIKUNJA_MAILER_FROMEMAIL: <my email>
Originally created by @zero-thermo on GitHub (Sep 21, 2022). Original GitHub issue: https://github.com/go-vikunja/vikunja/issues/48 Frontend v0.19.1 + API v0.19.2 setup via docker-compose. Emails are successfully sent and received, but with the following error in the API logs (and via ./vikunja testmail): ``` ERROR ▶ mail/func1 1bd Error closing the mail server connection: not connected to SMTP server ``` Bug or WAI? Used the following variables to enable email in docker-compose.yaml: ``` VIKUNJA_SERVICE_ENABLEEMAILREMINDERS: 1 VIKUNJA_MAILER_ENABLED: 1 VIKUNJA_MAILER_FORCESSL: 1 VIKUNJA_MAILER_HOST: <my smtp server> VIKUNJA_MAILER_PORT: 587 VIKUNJA_MAILER_USERNAME: <my username> VIKUNJA_MAILER_PASSWORD: <my password> VIKUNJA_MAILER_FROMEMAIL: <my email> ```
GiteaMirror added the bug label 2026-04-20 16:17:26 -05:00
Author
Owner

@kolaente commented on GitHub (Sep 21, 2022):

Might be a bug in Vikunja. Do you have any additional logs prior to the error?

<!-- gh-comment-id:1253749077 --> @kolaente commented on GitHub (Sep 21, 2022): Might be a bug in Vikunja. Do you have any additional logs prior to the error?
Author
Owner

@zero-thermo commented on GitHub (Sep 22, 2022):

Here's what the logs show before, including, and after the error:

2022-09-22T00:37:06.370592767Z: WEB 	▶ <IP>  GET 200 /api/v1/notifications?page=1 1.846777ms - Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:104.0) Gecko/20100101 Firefox/104.0
2022-09-22T00:37:16.499839757Z: WEB 	▶ <IP>  GET 200 /api/v1/notifications?page=1 5.073597ms - Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:104.0) Gecko/20100101 Firefox/104.0
2022-09-22T00:37:26.604436232Z: WEB 	▶ <IP>  GET 200 /api/v1/notifications?page=1 5.518018ms - Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:104.0) Gecko/20100101 Firefox/104.0
2022-09-22T00:37:30.132440589Z: ERROR	▶ mail/func1 a931 Error closing the mail server connection: %s
 not connected to SMTP server
2022-09-22T00:37:36.706769919Z: WEB 	▶ <IP>  GET 200 /api/v1/notifications?page=1 4.733399ms - Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:104.0) Gecko/20100101 Firefox/104.0
2022-09-22T00:37:46.812540956Z: WEB 	▶ <IP>  GET 200 /api/v1/notifications?page=1 5.149469ms - Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:104.0) Gecko/20100101 Firefox/104.0
2022-09-22T00:37:56.839547575Z: WEB 	▶ <IP>  GET 200 /api/v1/notifications?page=1 22.89368ms - Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:104.0) Gecko/20100101 Firefox/104.0
<!-- gh-comment-id:1254371784 --> @zero-thermo commented on GitHub (Sep 22, 2022): Here's what the logs show before, including, and after the error: ``` 2022-09-22T00:37:06.370592767Z: WEB ▶ <IP> GET 200 /api/v1/notifications?page=1 1.846777ms - Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:104.0) Gecko/20100101 Firefox/104.0 2022-09-22T00:37:16.499839757Z: WEB ▶ <IP> GET 200 /api/v1/notifications?page=1 5.073597ms - Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:104.0) Gecko/20100101 Firefox/104.0 2022-09-22T00:37:26.604436232Z: WEB ▶ <IP> GET 200 /api/v1/notifications?page=1 5.518018ms - Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:104.0) Gecko/20100101 Firefox/104.0 2022-09-22T00:37:30.132440589Z: ERROR ▶ mail/func1 a931 Error closing the mail server connection: %s not connected to SMTP server 2022-09-22T00:37:36.706769919Z: WEB ▶ <IP> GET 200 /api/v1/notifications?page=1 4.733399ms - Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:104.0) Gecko/20100101 Firefox/104.0 2022-09-22T00:37:46.812540956Z: WEB ▶ <IP> GET 200 /api/v1/notifications?page=1 5.149469ms - Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:104.0) Gecko/20100101 Firefox/104.0 2022-09-22T00:37:56.839547575Z: WEB ▶ <IP> GET 200 /api/v1/notifications?page=1 22.89368ms - Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:104.0) Gecko/20100101 Firefox/104.0 ```
Author
Owner

@kolaente commented on GitHub (Sep 22, 2022):

And with the vikunja testmail command?

<!-- gh-comment-id:1255137973 --> @kolaente commented on GitHub (Sep 22, 2022): And with the `vikunja testmail` command?
Author
Owner

@zero-thermo commented on GitHub (Sep 22, 2022):

Results of running docker exec -it vikunja-api ./vikunja testmail <email>:

2022/09/22 23:22:12 No config file found, using default or config from environment variables.
2022-09-22T23:22:12.661400692Z: INFO	▶ cmd/func10 001 Sending testmail...
2022-09-22T23:22:14.134672894Z: ERROR	▶ cmd/func10 002 Error sending test mail: failed to close connction: not connected to SMTP server
<!-- gh-comment-id:1255653690 --> @zero-thermo commented on GitHub (Sep 22, 2022): Results of running `docker exec -it vikunja-api ./vikunja testmail <email>`: ``` 2022/09/22 23:22:12 No config file found, using default or config from environment variables. 2022-09-22T23:22:12.661400692Z: INFO ▶ cmd/func10 001 Sending testmail... 2022-09-22T23:22:14.134672894Z: ERROR ▶ cmd/func10 002 Error sending test mail: failed to close connction: not connected to SMTP server ```
Author
Owner

@kolaente commented on GitHub (Sep 23, 2022):

But the mail arrives?

<!-- gh-comment-id:1255926996 --> @kolaente commented on GitHub (Sep 23, 2022): But the mail arrives?
Author
Owner

@zero-thermo commented on GitHub (Sep 23, 2022):

Yes that's right -- emails are successfully sent and received in both cases despite the errors

<!-- gh-comment-id:1256415349 --> @zero-thermo commented on GitHub (Sep 23, 2022): Yes that's right -- emails are successfully sent and received in both cases despite the errors
Author
Owner

@LucaBernstein commented on GitHub (Sep 24, 2022):

For me at least the testmail sends successfully without an error.

go run ./... testmail testmail.vikunja@lucab.de

[...]
2022/09/24 19:53:03 Using config file: /dev/private/vikunja/api/config.yml
2022-09-24T19:53:03.495292+02:00: INFO  ▶ cmd/func10 001 Sending testmail...
2022-09-24T19:53:07.516869+02:00: INFO  ▶ cmd/func10 002 Testmail successfully sent.

Though I do get a similar error for the same config:

2022-09-24T19:57:11.592828+02:00: ERROR ▶ mail/func1 1ca Error closing the mail server connection: not connected to SMTP server

I also saw that for the created mail connection there is a default timeout of 15 seconds (mail.NewClient):

// DefaultTimeout is the default connection timeout
	DefaultTimeout = time.Second * 15

Passed timeout parameter to mail server. Now it works:

2022-09-24T20:13:37.324797+02:00: INFO  ▶ mail/func1 0cf Closed connection to mail server

Will open PR...


Edit: Opened PR: https://kolaente.dev/vikunja/api/pulls/1253

<!-- gh-comment-id:1257036118 --> @LucaBernstein commented on GitHub (Sep 24, 2022): For me at least the testmail sends successfully without an error. `go run ./... testmail testmail.vikunja@lucab.de` ``` [...] 2022/09/24 19:53:03 Using config file: /dev/private/vikunja/api/config.yml 2022-09-24T19:53:03.495292+02:00: INFO ▶ cmd/func10 001 Sending testmail... 2022-09-24T19:53:07.516869+02:00: INFO ▶ cmd/func10 002 Testmail successfully sent. ``` Though I do get a similar error for the same config: ``` 2022-09-24T19:57:11.592828+02:00: ERROR ▶ mail/func1 1ca Error closing the mail server connection: not connected to SMTP server ``` I also saw that for the created mail connection there is a default timeout of 15 seconds (mail.NewClient): ``` // DefaultTimeout is the default connection timeout DefaultTimeout = time.Second * 15 ``` --- Passed timeout parameter to mail server. Now it works: ``` 2022-09-24T20:13:37.324797+02:00: INFO ▶ mail/func1 0cf Closed connection to mail server ``` Will open PR... --- Edit: Opened PR: https://kolaente.dev/vikunja/api/pulls/1253
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/vikunja#5882