[GH-ISSUE #3688] [bug]: SMTP configuration not working #1273

Closed
opened 2026-03-16 19:34:11 +03:00 by kerem · 7 comments
Owner

Originally created by @skyalbrigonia on GitHub (Dec 21, 2023).
Original GitHub issue: https://github.com/hoppscotch/hoppscotch/issues/3688

Is there an existing issue for this?

  • I have searched the existing issues

Current behavior

when i try to send an invitation in the admin panel i see a failure.

LOGS:

Backend Server | [Nest] 45  - 12/21/2023, 4:46:23 PM   ERROR [ExceptionsHandler] email/failed
Backend Server | Error: email/failed
Backend Server |     at throwErr (/usr/src/app/packages/hoppscotch-backend/dist/utils.js:14:11)
Backend Server |     at AdminResolver.inviteNewUser (/usr/src/app/packages/hoppscotch-backend/dist/admin/admin.resolver.js:106:34)
Backend Server |     at async target (/usr/src/app/node_modules/.pnpm/@nestjs+core@10.2.7_@nestjs+common@10.2.7_@nestjs+platform-express@10.2.7_reflect-metadata@0.1.13_rxjs@7.6.0/node_modules/@nestjs/core/helpers/external-context-creator.js:74:28)
Backend Server |     at async Object.inviteNewUser (/usr/src/app/node_modules/.pnpm/@nestjs+core@10.2.7_@nestjs+common@10.2.7_@nestjs+platform-express@10.2.7_reflect-metadata@0.1.13_rxjs@7.6.0/node_modules/@nestjs/core/helpers/external-proxy.js:9:24)

MY_CONF:

  - name: MAILER_SMTP_URL
    value: "smtps://myemail@gmail.com:mypassword@smtp.gmail.com"
  - name: MAILER_ADDRESS_FROM
    value: '"my email" <myemail@gmail.com>'

I also tried with smtp and port 587 but it doesn't work

Steps to reproduce

1 - Go to Admin Website
2 - invite new member

Environment

Production

Version

Self-hosted

Originally created by @skyalbrigonia on GitHub (Dec 21, 2023). Original GitHub issue: https://github.com/hoppscotch/hoppscotch/issues/3688 ### Is there an existing issue for this? - [X] I have searched the existing issues ### Current behavior when i try to send an invitation in the admin panel i see a failure. LOGS: ``` Backend Server | [Nest] 45 - 12/21/2023, 4:46:23 PM ERROR [ExceptionsHandler] email/failed Backend Server | Error: email/failed Backend Server | at throwErr (/usr/src/app/packages/hoppscotch-backend/dist/utils.js:14:11) Backend Server | at AdminResolver.inviteNewUser (/usr/src/app/packages/hoppscotch-backend/dist/admin/admin.resolver.js:106:34) Backend Server | at async target (/usr/src/app/node_modules/.pnpm/@nestjs+core@10.2.7_@nestjs+common@10.2.7_@nestjs+platform-express@10.2.7_reflect-metadata@0.1.13_rxjs@7.6.0/node_modules/@nestjs/core/helpers/external-context-creator.js:74:28) Backend Server | at async Object.inviteNewUser (/usr/src/app/node_modules/.pnpm/@nestjs+core@10.2.7_@nestjs+common@10.2.7_@nestjs+platform-express@10.2.7_reflect-metadata@0.1.13_rxjs@7.6.0/node_modules/@nestjs/core/helpers/external-proxy.js:9:24) ``` MY_CONF: ``` - name: MAILER_SMTP_URL value: "smtps://myemail@gmail.com:mypassword@smtp.gmail.com" - name: MAILER_ADDRESS_FROM value: '"my email" <myemail@gmail.com>' ``` I also tried with smtp and port 587 but it doesn't work ### Steps to reproduce 1 - Go to Admin Website 2 - invite new member ### Environment Production ### Version Self-hosted
kerem 2026-03-16 19:34:11 +03:00
Author
Owner

@shipko commented on GitHub (Dec 28, 2023):

@skyalbrigonia try to replace myemail@gmail.com -> myemail in MAILER_SMTP_URL parameter

<!-- gh-comment-id:1870809381 --> @shipko commented on GitHub (Dec 28, 2023): @skyalbrigonia try to replace myemail@gmail.com -> myemail in MAILER_SMTP_URL parameter
Author
Owner

@lelered commented on GitHub (Jan 1, 2024):

Hi,
can you check the "MAILER_*" values in database in InfraConfig table?
A sample query could be:
SELECT name, value FROM "public"."InfraConfig" WHERE "name" LIKE 'MAILER_%';

After configuring the final and correct environment values, you can solve it by destroying and recreating the database.
(It seems like the configuration is saved in database on first boot)
Maybe, another solution would be to try changing the values in the database (for MAILER_SMTP_URL and MAILER_ADDRESS_FROM) and restart the server.

<!-- gh-comment-id:1873426148 --> @lelered commented on GitHub (Jan 1, 2024): Hi, can you check the "MAILER_*" values in database in `InfraConfig` table? A sample query could be: `SELECT name, value FROM "public"."InfraConfig" WHERE "name" LIKE 'MAILER_%';` After configuring the final and correct environment values, you can solve it by **destroying and recreating the database**. (It seems like the configuration is saved in database on first boot) Maybe, another solution would be to try **changing the values in the database** (for `MAILER_SMTP_URL` and `MAILER_ADDRESS_FROM`) and restart the server.
Author
Owner

@restmad commented on GitHub (Jan 2, 2024):

remove email dependency!!!

<!-- gh-comment-id:1873959397 --> @restmad commented on GitHub (Jan 2, 2024): remove email dependency!!!
Author
Owner

@skyalbrigonia commented on GitHub (Jan 2, 2024):

Hi all! i checked the DB as @lelered suggested and the error was there.
I updated the table and restarted the service and now the notification works!

I saw that in the notification email the URL is "undefined", am i missing a configuration?

this is the message:

If you’re having trouble with the button above, copy and paste the URL below into your web browser.

undefined/enter?token=clqw3tdhz0001fm1b6pig42sw

Thanks a lot for the help!

<!-- gh-comment-id:1874015132 --> @skyalbrigonia commented on GitHub (Jan 2, 2024): Hi all! i checked the DB as @lelered suggested and the error was there. I updated the table and restarted the service and now the notification works! I saw that in the notification email the URL is "undefined", am i missing a configuration? this is the message: ``` If you’re having trouble with the button above, copy and paste the URL below into your web browser. undefined/enter?token=clqw3tdhz0001fm1b6pig42sw ``` Thanks a lot for the help!
Author
Owner

@corelgott commented on GitHub (Jan 3, 2024):

image

It seems the env var is only evaluated on the first start and then copied to the db. These are the default settings that do not reflect the smtp settings in the MAILER_SMTP_URL, that was altered later. After connecting to the db with this vs extension

and running these updates:

UPDATE "InfraConfig"
SET value = 'smtps://your@email.tld:passwort@smtp.server.tld?logging=true&debug=true'
WHERE name='MAILER_SMTP_URL';

UPDATE "InfraConfig"
SET value = '"Hoppscotch" <hoppscotch@server.tld>'
WHERE name='MAILER_ADDRESS_FROM';

the email was sent successfully.

<!-- gh-comment-id:1876094646 --> @corelgott commented on GitHub (Jan 3, 2024): <img width="715" alt="image" src="https://github.com/hoppscotch/hoppscotch/assets/3868441/27fdc14f-9391-4f17-a273-2eba114647d9"> It seems the env var is only evaluated on the first start and then copied to the db. These are the default settings that do not reflect the smtp settings in the MAILER_SMTP_URL, that was altered later. After connecting to the db with [this vs extension](https://marketplace.visualstudio.com/items?itemName=ckolkman.vscode-postgres) and running these updates: ``` UPDATE "InfraConfig" SET value = 'smtps://your@email.tld:passwort@smtp.server.tld?logging=true&debug=true' WHERE name='MAILER_SMTP_URL'; UPDATE "InfraConfig" SET value = '"Hoppscotch" <hoppscotch@server.tld>' WHERE name='MAILER_ADDRESS_FROM'; ``` the email was sent successfully.
Author
Owner

@skyalbrigonia commented on GitHub (Jan 5, 2024):

Hi all!
I fixed the problem also for the undefined url in the mail message:

If you’re having trouble with the button above, copy and paste the URL below into your web browser.

undefined/enter?token=clqw3tdhz0001fm1b6pig42sw

you need to populate these two vars also in the backend env:

VITE_BASE_URL and VITE_SHORTCODE_BASE_URL

Thanks a lot for the help!

<!-- gh-comment-id:1878422906 --> @skyalbrigonia commented on GitHub (Jan 5, 2024): Hi all! I fixed the problem also for the undefined url in the mail message: ``` If you’re having trouble with the button above, copy and paste the URL below into your web browser. undefined/enter?token=clqw3tdhz0001fm1b6pig42sw ``` you need to populate these two vars also in the backend env: `VITE_BASE_URL` and `VITE_SHORTCODE_BASE_URL` Thanks a lot for the help!
Author
Owner

@icharge commented on GitHub (Jun 16, 2024):

I didn't understand why design to using only email to get logged in.

<!-- gh-comment-id:2171121511 --> @icharge commented on GitHub (Jun 16, 2024): I didn't understand why design to using only email to get logged in.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/hoppscotch#1273
No description provided.