go-vikunja / vikunja

Mirror of vikunja from https://code.vikunja.io/api
GNU Affero General Public License v3.0
1.03k stars 71 forks source link

SMTP Connection Issues and Log Errors #300

Closed uyu423 closed 3 months ago

uyu423 commented 3 months ago

Description

Hello, I am using Vikunja for self-hosting for the first time today.

I've encountered a few issues while configuring email settings and wanted to report them. Here is the docker-compose.yml configuration I'm using:

  vikunja:
    image: vikunja/vikunja
    container_name: vikunja
    environment:
      VIKUNJA_SERVICE_ENABLEREGISTRATION: false
      VIKUNJA_SERVICE_PUBLICURL: <hostname>
      VIKUNJA_LOG_HTTP: off
      VIKUNJA_DATABASE_HOST: vikunja_mariadb
      VIKUNJA_DATABASE_PASSWORD: <password>
      VIKUNJA_DATABASE_TYPE: mysql
      VIKUNJA_DATABASE_USER: vikunja
      VIKUNJA_DATABASE_DATABASE: vikunja
      VIKUNJA_REDIS_ENABLED: true
      VIKUNJA_REDIS_HOST: vikunja_redis:6379
      VIKUNJA_SERVICE_JWTSECRET: <secret>
      VIKUNJA_SERVICE_TIMEZONE: Asia/Seoul
      VIKUNJA_FILES_MAXSIZE: 50MB
      VIKUNJA_MAILER_ENABLED: true
      VIKUNJA_MAILER_HOST: smtp.mailgun.org
        # VIKUNJA_MAILER_PORT: 465
      VIKUNJA_MAILER_AUTHTYPE: login
      VIKUNJA_MAILER_USERNAME: <username>
      VIKUNJA_MAILER_PASSWORD: <password>
      VIKUNJA_MAILER_FROMEMAIL: no-reply@email.com
      VIKUNJA_DEFAULTSETTINGS_EMAIL_REMINDERS_ENABLED: true
      VIKUNJA_LOG_LEVEL: debug
    ports:
      - 9003:3456
    volumes:
      - /external/vikunja/files:/app/vikunja/files
    depends_on:
      vikunja_mariadb:
        condition: service_healthy
      vikunja_redis:
        condition: service_started
    restart: always
    networks:
      - vikunja_network
  1. Email sent successfully, but error logged

    Although the email was successfully received, the server log shows Error closing the mail server connection: not connected to SMTP server. Even when checking with DEBUG log level, there is no additional information.

2024-08-01T18:31:01.513959089Z: ERROR   ▶ mail/func1 21e Error closing the mail server connection: not connected to SMTP server
  1. Unable to use SMTP server port 465

    Is it not possible to use SMTP? It works fine with the default port (although the above issue occurs), but when using port 465 for SSL, only the log below is displayed, and it does not proceed.

docker exec -it vikunja /app/vikunja/vikunja testmail {email}
2024-08-01T18:20:01.681750819Z: INFO    ▶ config/InitConfig 001 No config file found, using default or config from environment variables.
2024-08-01T18:20:01.682638413Z: INFO    ▶ cmd/func12 003 Sending testmail...

Looking forward to using Vikunja starting today. Thank you.

Vikunja Version

v0.24.1

Browser and version

Google Chrome 127.0.6533.73 (arm64)

Can you reproduce the bug on the Vikunja demo site?

No

Screenshots

No response

kolaente commented 3 months ago

Does it work if you set the forcessl option?

uyu423 commented 3 months ago

Test

@kolaente

I tried testmail with the docker-compose config below

services:
  vikunja:
    image: vikunja/vikunja
    container_name: vikunja
    environment:
      # ...
      VIKUNJA_MAILER_ENABLED: true
      VIKUNJA_MAILER_HOST: smtp.mailgun.org
      VIKUNJA_MAILER_PORT: 465
      VIKUNJA_MAILER_AUTHTYPE: login
      VIKUNJA_MAILER_USERNAME: {username}
      VIKUNJA_MAILER_PASSWORD: {password}
      VIKUNJA_MAILER_FROMEMAIL: {frommail}
      VIKUNJA_MAILER_FORCESSL: true
      VIKUNJA_LOG_LEVEL: debug
    ports:
      - 9003:3456
    depends_on:
      vikunja_mariadb:
        condition: service_healthy
      vikunja_redis:
        condition: service_started
    restart: always
docker exec -it vikunja /app/vikunja/vikunja testmail my@email.com

2024-08-08T10:07:42.663643838+09:00: INFO   ▶ config/InitConfig 001 No config file found, using default or config from environment variables.
2024-08-08T10:07:42.664471278+09:00: DEBUG  ▶ red/InitRedis 002 Redis initialized
2024-08-08T10:07:42.664538572+09:00: INFO   ▶ cmd/func12 003 Sending testmail...
2024-08-08T10:07:45.963434693+09:00: ERROR  ▶ cmd/func12 01e Error sending test mail: failed to close connction: not connected to SMTP server

Now mail is sent to port 465, but SMTP connection issue is still reproduced. (I received the mail, but only error log remains)

kolaente commented 3 months ago

Closing as resolved, feel free to ping if you have other issues. Fixed in 40bb86bee59585f827752e96c87e5e8c8f81495c, please check with the next unstable build (should be ready for deployment in ~45min).