quant-ux icon indicating copy to clipboard operation
quant-ux copied to clipboard

Error in backend while sending an email message

Open eandersons opened this issue 7 months ago • 5 comments

I cannot manage to get back-end to send email messages.

I launched Quant-UX using Docker Compose:

services:
  database:
    restart: unless-stopped
    image: mongo
    volumes:
      - db-data:/data/db
      - mongo-config:/data/configdb

  frontend:
    restart: unless-stopped
    image: klausenschaefersinho/quant-ux
    environment:
      QUX_PROXY_URL: http://backend:8080
      QUX_AUTH: qux
      QUX_KEYCLOAK_REALM:
      QUX_KEYCLOAK_CLIENT:
      QUX_KEYCLOAK_URL:
      QUX_WS_URL: wss://localhost:8082/ws
    ports:
      - 127.0.0.1:8082:8082
    depends_on:
      - backend

  backend:
    restart: unless-stopped
    image: klausenschaefersinho/quant-ux-backend
    volumes:
      - data:/app-data
    environment:
      QUX_HTTP_HOST: http://localhost:8082  # this is the URL included in the mails, e.g. password resets
      QUX_HTTP_PORT: 8080  # This is the port the backend will use
      QUX_MONGO_DB_NAME: quantux  # the database / collection name in mongodb
      QUX_MONGO_TABLE_PREFIX: quantux  # table / document prefix in mongodb
      QUX_MONGO_CONNECTION_STRING: mongodb://database:27017
      QUX_MAIL_USER: [email protected]
      QUX_MAIL_PASSWORD: 1passwordwith,and;
      QUX_MAIL_HOST: mail.example.org
      QUX_MAIL_PORT: 587
      QUX_MAIL_SSL: required
      QUX_JWT_PASSWORD: quxjwtpassword  # you should change this to a real JWT secret
      QUX_IMAGE_FOLDER_USER: /app-data/qux-images
      QUX_IMAGE_FOLDER_APPS: /app-data/qux-image-apps
      TZ: Europe/Riga
      QUX_AUTH_SERVICE: qux
      QUX_KEYCLOAK_SERVER:  # just the keycloak host & port
      QUX_KEYCLOAK_REALM:
      QUX_USER_ALLOW_SIGNUP: 'true'
      QUX_USER_ALLOWED_DOMAINS: '*'  # comma separated list of domains, e.g. 'my-server.com' or '*' for all
      #QUX_DEBUG: 'true'
    depends_on:
      - database

  websocket:
    restart: unless-stopped
    image: klausenschaefersinho/quant-ux-websocket
    environment:
      QUX_SERVER: http://backend:8080/
      QUX_SERVER_PORT: 8086
    ports:
      - 127.0.0.1:8086:8086
    depends_on:
      - backend

volumes:
  data:
  db-data:
  mongo-config:

, and below is back-end container's log when an email message should be sent:

WARNING: sun.reflect.Reflection.getCallerClass is not supported. This will impact performance.
15:03:04.709 [vert.x-eventloop-thread-0] ERROR com.qux.util.Config - mergeUser() > QUX_USER_ALLOW_SIGNUP > true
15:03:04.916 [vert.x-eventloop-thread-0] ERROR com.qux.MATC - createMail() > DISABLE MAIL SSL!
******************************************
* Quant-UX-Server 4.5.6 launched at 8080
******************************************
Jan 04, 2024 3:03:05 PM io.vertx.core.Starter
INFO: Succeeded in deploying verticle
Jan 04, 2024 3:04:02 PM io.vertx.ext.mail.impl.SMTPSendMail
WARNING: sender address not accepted: 530 5.7.0 Must issue a STARTTLS command first
15:04:02.764 [vert.x-eventloop-thread-0] ERROR com.qux.bus.MailHandler - handle() > from: [email protected] >> to : [[email protected]] >> subject : Password Reset >> txt: Dear Name

you have requested a new password. Please follow the link to set a new password:

https://quant-ux.example.org/#/reset_password3.html?id=reallylongid


Your Quant-UX Team.

15:04:02.765 [vert.x-eventloop-thread-0] ERROR com.qux.bus.MailHandler - handle() > Could not send mail to [email protected]
15:04:02.765 [vert.x-eventloop-thread-0] ERROR com.qux.bus.MailHandler - handle() > error:
io.vertx.core.impl.NoStackTraceThrowable: sender address not accepted: 530 5.7.0 Must issue a STARTTLS command first
io.vertx.core.impl.NoStackTraceThrowable: sender address not accepted: 530 5.7.0 Must issue a STARTTLS command first

The same outcome is when I set the environment variable QUX_MAIL_PORT with the value 587 and QUX_MAIL_SSL with the value required (I took a look at back-end's code and it seems that these values are used by default).

I added the environment variable QUX_DEBUG with the value true, and there was no errors in back-end container's log, but email was not received anyway.

WARNING: sun.reflect.Reflection.getCallerClass is not supported. This will impact performance.
15:23:49.824 [vert.x-eventloop-thread-0] ERROR com.qux.util.Config - mergeDebug() > QUX_DEBUG > true
15:23:49.832 [vert.x-eventloop-thread-0] ERROR com.qux.util.Config - mergeUser() > QUX_USER_ALLOW_SIGNUP > true
******************************************
* Quant-UX-Server 4.5.6 launched at 8080
******************************************
Jan 04, 2024 3:23:50 PM io.vertx.core.Starter
INFO: Succeeded in deploying verticle
15:25:55.729 [vert.x-eventloop-thread-0] ERROR com.qux.rest.UserREST - error() > *ATTENTION* Wrong login for [email protected]

Everything is working fine with the same email server with Penpot with the following environment variables:

services:
  ...

  backend:
    ...
    environment:
      ...
      PENPOT_SMTP_DEFAULT_FROM: [email protected]
      PENPOT_SMTP_DEFAULT_REPLY_TO: [email protected]
      PENPOT_SMTP_HOST: mail.example.org
      PENPOT_SMTP_PORT: 587
      PENPOT_SMTP_USERNAME: [email protected]
      PENPOT_SMTP_PASSWORD: strongpassword
      PENPOT_SMTP_TLS: 'true'
      PENPOT_SMTP_SSL: 'false'
    ...

  ...

...

, so the issue does not seem to be related to the email server.

Out of curiosity I tried to change the value of QUX_MAIL_PORT to 465, and this time the error was different:

WARNING: sun.reflect.Reflection.getCallerClass is not supported. This will impact performance.
15:14:46.331 [vert.x-eventloop-thread-0] ERROR com.qux.util.Config - mergeUser() > QUX_USER_ALLOW_SIGNUP > true
15:14:46.483 [vert.x-eventloop-thread-0] ERROR com.qux.MATC - createMail() > DISABLE MAIL SSL!
******************************************
* Quant-UX-Server 4.5.6 launched at 8080
******************************************
Jan 04, 2024 3:14:46 PM io.vertx.core.Starter
INFO: Succeeded in deploying verticle
15:15:08.791 [vert.x-eventloop-thread-0] ERROR com.qux.rest.UserREST - error() > *ATTENTION* Wrong login for [email protected]
15:20:00.701 [vert.x-eventloop-thread-0] ERROR com.qux.bus.MailHandler - handle() > from: [email protected] >> to : [[email protected]] >> subject : Password Reset >> txt: Dear Name

you have requested a new password. Please follow the link to set a new password:

https://quant-ux.example.org/#/reset_password3.html?id=anotherreallylongid


You Quant-UX Team.
15:20:00.701 [vert.x-eventloop-thread-0] ERROR com.qux.bus.MailHandler - handle() > Could not send mail to [email protected]
15:20:00.701 [vert.x-eventloop-thread-0] ERROR com.qux.bus.MailHandler - handle() > error:
io.vertx.core.impl.NoStackTraceThrowable: connection has been closed by the server
io.vertx.core.impl.NoStackTraceThrowable: connection has been closed by the server

Am I missing something?

eandersons avatar Jan 04 '24 15:01 eandersons