immich icon indicating copy to clipboard operation
immich copied to clipboard

Username used for SMTP auth is not valid email address

Open lusu007 opened this issue 1 year ago • 0 comments

The bug

I'm trying to use Sendgrid for Mail sending. SendGrid uses the username apikey for authentication, but Immich only accepts email addresses as a username,

The OS that Immich Server is running on

Ubuntu 22.04.4

Version of Immich Server

v1.104.0

Platform with the issue

  • [X] Server
  • [ ] Web
  • [ ] Mobile

Your docker-compose.yml content

name: immich
services:
  immich-server:
    container_name: immich_server
    image: ghcr.io/immich-app/immich-server:${IMMICH_VERSION:-release}
    command: ['start.sh', 'immich']
    volumes:
      - ${UPLOAD_LOCATION}:/usr/src/app/upload
      - /etc/localtime:/etc/localtime:ro
    env_file:
      - .env
    ports:
      - 2283:3001
    depends_on:
      - redis
      - database
    restart: always
  immich-microservices:
    container_name: immich_microservices
    image: ghcr.io/immich-app/immich-server:${IMMICH_VERSION:-release}
    command: ['start.sh', 'microservices']
    volumes:
      - ${UPLOAD_LOCATION}:/usr/src/app/upload
      - /etc/localtime:/etc/localtime:ro
    env_file:
      - .env
    depends_on:
      - redis
      - database
    restart: always
  redis:
    container_name: immich_redis
    image: registry.hub.docker.com/library/redis:6.2-alpine@sha256:51d6c56749a4243096327e3fb964a48ed92254357108449cb6e23999c37773c5
    restart: always
  database:
    container_name: immich_postgres
    image: registry.hub.docker.com/tensorchord/pgvecto-rs:pg14-v0.2.0@sha256:90724186f0a3517cf6914295b5ab410db9ce23190a2d9d0b9dd6463e3fa298f0
    environment:
      POSTGRES_PASSWORD: ${DB_PASSWORD}
      POSTGRES_USER: ${DB_USERNAME}
      POSTGRES_DB: ${DB_DATABASE_NAME}
    volumes:
      - pgdata:/var/lib/postgresql/data
    restart: always
volumes:
  pgdata:
  model-cache:

Your .env content

# The location where your uploaded files are stored
UPLOAD_LOCATION=/mnt/ssd-1tb/library

# The Immich version to use. You can pin this to a specific version like "v1.71.0"
IMMICH_VERSION=release

# Connection secret for postgres. You should change it to a random password
DB_PASSWORD=password

# The values below this line do not need to be changed
###################################################################################
DB_HOSTNAME=immich_postgres
DB_USERNAME=postgres
DB_DATABASE_NAME=immich

REDIS_HOSTNAME=immich_redis

Reproduction steps

1. Try using `apikey` as the username for the SMTP server.

Relevant log output

immich_server         | [Nest] 7  - 05/14/2024, 2:14:42 PM   ERROR [NotificationService] Failed to validate SMTP configuration: Error: Invalid login: 501 Username used for auth is not valid email address
immich_server         | Error: Invalid login: 501 Username used for auth is not valid email address
immich_server         |     at SMTPConnection._formatError (/usr/src/app/node_modules/nodemailer/lib/smtp-connection/index.js:798:19)
immich_server         |     at SMTPConnection._actionAUTHComplete (/usr/src/app/node_modules/nodemailer/lib/smtp-connection/index.js:1577:34)
immich_server         |     at SMTPConnection.<anonymous> (/usr/src/app/node_modules/nodemailer/lib/smtp-connection/index.js:554:26)
immich_server         |     at SMTPConnection._processResponse (/usr/src/app/node_modules/nodemailer/lib/smtp-connection/index.js:982:20)
immich_server         |     at SMTPConnection._onData (/usr/src/app/node_modules/nodemailer/lib/smtp-connection/index.js:763:14)
immich_server         |     at SMTPConnection._onSocketData (/usr/src/app/node_modules/nodemailer/lib/smtp-connection/index.js:195:44)
immich_server         |     at TLSSocket.emit (node:events:518:28)
immich_server         |     at addChunk (node:internal/streams/readable:559:12)
immich_server         |     at readableAddChunkPushByteMode (node:internal/streams/readable:510:3)
immich_server         |     at Readable.push (node:internal/streams/readable:390:5)
immich_server         | [Nest] 7  - 05/14/2024, 2:14:42 PM    WARN [SystemConfigService] Unable to save system config due to a validation error: Error: Invalid SMTP configuration: Error: Invalid login: 501 Username used for auth is not valid email address
immich_server         | [Nest] 7  - 05/14/2024, 2:14:58 PM   ERROR [NotificationService] Failed to validate SMTP configuration: Error: Invalid login: 501 Username used for auth is not valid email address
immich_server         | Error: Invalid login: 501 Username used for auth is not valid email address
immich_server         |     at SMTPConnection._formatError (/usr/src/app/node_modules/nodemailer/lib/smtp-connection/index.js:798:19)
immich_server         |     at SMTPConnection._actionAUTHComplete (/usr/src/app/node_modules/nodemailer/lib/smtp-connection/index.js:1577:34)
immich_server         |     at SMTPConnection.<anonymous> (/usr/src/app/node_modules/nodemailer/lib/smtp-connection/index.js:554:26)
immich_server         |     at SMTPConnection._processResponse (/usr/src/app/node_modules/nodemailer/lib/smtp-connection/index.js:982:20)
immich_server         |     at SMTPConnection._onData (/usr/src/app/node_modules/nodemailer/lib/smtp-connection/index.js:763:14)
immich_server         | [Nest] 7  - 05/14/2024, 2:14:58 PM    WARN [SystemConfigService] Unable to save system config due to a validation error: Error: Invalid SMTP configuration: Error: Invalid login: 501 Username used for auth is not valid email address
immich_server         |     at SMTPConnection._onSocketData (/usr/src/app/node_modules/nodemailer/lib/smtp-connection/index.js:195:44)
immich_server         |     at TLSSocket.emit (node:events:518:28)
immich_server         |     at addChunk (node:internal/streams/readable:559:12)
immich_server         |     at readableAddChunkPushByteMode (node:internal/streams/readable:510:3)
immich_server         |     at Readable.push (node:internal/streams/readable:390:5)

lusu007 avatar May 14 '24 14:05 lusu007