Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AUTH_EMAIL_FROM does not support 'noreply <[email protected]>' configuration #1735

Open
antonchen opened this issue Jan 29, 2024 · 6 comments
Assignees

Comments

@antonchen
Copy link

failed to send confirmation - bad from address "noreply <[email protected]>": 501 mail from address must be same as authorization user - 500 - IP - /auth/email/login?site=RawLab&[email protected]&user=Anton [caused by auth/provider/verify.go:194 provider.VerifyHandler.sendConfirmation]
@paskal
Copy link
Collaborator

paskal commented Feb 18, 2024

You need to use AUTH_EMAIL_FROM and NOTIFY_EMAIL_FROM variables like that:

      - [email protected]
      - NOTIFY_USERS=email
      - NOTIFY_ADMINS=email
      - SMTP_TLS=true
      - SMTP_HOST=smtp.sendgrid.net
      - SMTP_PORT=465
      - SMTP_USERNAME=apikey
      - SMTP_PASSWORD=secret_password
      - AUTH_EMAIL_FROM="My auth system notification using SendGrid"<[email protected]>
      - NOTIFY_EMAIL_FROM="My notification system using SendGrid"<[email protected]>

It looks like that in the Gmail:
image

Resolving: feel free to reopen if I'm wrong, and that's different from what you are looking for.

@paskal paskal closed this as completed Feb 18, 2024
@antonchen
Copy link
Author

antonchen commented Feb 21, 2024

My remark42 is running on fly.io, fly.io environment variable configuration

[env]
   AUTH_EMAIL_ENABLE = 'true'
   AUTH_EMAIL_FROM = '[email protected]'
  # I tried the following configuration, but got the same error.
  # fly.io configuration requires that the value of the variable needs quotes
  # AUTH_EMAIL_FROM = 'Notify <[email protected]>'
  # AUTH_EMAIL_FROM = 'Notify<[email protected]>'
  # AUTH_EMAIL_FROM = '"Notify"<[email protected]>'

I used an old version before without this problem, but I can't remember the version number

@paskal paskal reopened this Feb 21, 2024
@paskal
Copy link
Collaborator

paskal commented Feb 21, 2024

Can you please try the master version of the container and see if the problem reproduces? Finding the version that's not broken for you would be very useful if it is. The format is like in my example, AUTH_EMAIL_FROM="My auth system notification using SendGrid"<[email protected]> - text in quotes, then email in the brackets.

@antonchen
Copy link
Author

The issue originated from a modification in fly.io's configuration file format, which introduced a requirement for environment variable values to be enclosed in quotes. As a result, I couldn't transfer the environment variable in the format AUTH_EMAIL_FROM="My auth system notification using SendGrid"[email protected] to the container.

My attempt to conform to fly.io's format by passing AUTH_EMAIL_FROM='"My auth system notification using SendGrid"<[email protected]>' led to remark42 receiving the value as "\"My auth system notification using SendGrid\"<[email protected]>", triggering errors.

@paskal
Copy link
Collaborator

paskal commented Mar 16, 2024

I can't reproduce it, unfortunately. My config:

[env]
  AUTH_EMAIL_FROM = '"My auth system notification using SendGrid"<[email protected]>'
❯ fly ssh console     
Connecting to fdaa:8:b685:a7b:c988:1ee8:e670:2... complete
root@178190eb244008:/usr/src/app# env | grep AUTH_EMAIL_FROM
AUTH_EMAIL_FROM="My auth system notification using SendGrid"<[email protected]>

What is the output of env | grep AUTH_EMAIL_FROM in your case?

@paskal paskal self-assigned this Mar 16, 2024
@antonchen
Copy link
Author

2024/03/17 11:44:55.713 [INFO] failed to send confirmation - bad from address "\"Noreply RawLab\"<[email protected]>": 501 mail from address must be same as authorization user - 500 - 46.3.241.98 - /auth/email/login?site=RawLab&[email protected]&user=Anton [caused by auth/provider/verify.go:191 provider.VerifyHandler.sendConfirmation]

My config:

app = 'rawlab-comments'
primary_region = 'nrt'
kill_signal = 'SIGINT'
kill_timeout = '10s'
console_command = '/bin/sh'

[experimental]
  auto_rollback = true

[build]
  image = 'umputun/remark42:master'

[env]
  ADMIN_SHARED_ID = 'github_a0d8d890470be032928ee4faf4a4e67bc5e3e755'
  AUTH_EMAIL_ENABLE = 'true'
  AUTH_EMAIL_FROM = '"Noreply RawLab"<[email protected]>'
  AUTH_EMAIL_SUBJ = 'Email verification'
  AUTH_TELEGRAM = 'true'
  DEBUG = 'false'
  EMOJI = 'true'
  NOTIFY_ADMINS = 'telegram'
  NOTIFY_USERS = 'telegram,email'
  REMARK_PORT = '8080'
  REMARK_URL = 'https://cm.rawlab.net'
  SITE = 'RawLab'
  TIME_ZONE = 'Asia/Shanghai'

[[mounts]]
  source = 'remark42_data'
  destination = '/srv/var'
  initial_size = '1GB'

[http_service]
  internal_port = 8080
  auto_stop_machines = true
  auto_start_machines = true
  min_machines_running = 1
  processes = ['app']

[[http_service.checks]]
    interval = '30s'
    timeout = '5s'
    grace_period = '10s'
    method = 'GET'
    path = '/ping'

[[services]]
  protocol = 'tcp'
  internal_port = 8080
  processes = ['app']

[[services.ports]]
    port = 80
    handlers = ['http']

[[services.ports]]
    port = 443
    handlers = ['tls', 'http']

    [services.ports.http_options]
      [services.ports.http_options.response]
        [services.ports.http_options.response.headers]
          Access-Control-Allow-Origin = '*'
          App-Name = false
          App-Version = false
          Autho = false

[[vm]]
  cpu_kind = 'shared'
  cpus = 1
  memory_mb = 256

Console:

> flyctl ssh console
Connecting to fdaa:1:140d:a7b:22f:5db0:78b8:2... complete
91852e3ea5de38:/srv# env | grep AUTH_EMAIL_FROM
AUTH_EMAIL_FROM="Noreply RawLab"<[email protected]>
91852e3ea5de38:/srv#

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants