Skip to content

Bug: Self Hosted: In the "Forgot Password" flow, password reset email is not sent #1762

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

Open
1 of 2 tasks
segleaur opened this issue Feb 1, 2025 · 8 comments
Open
1 of 2 tasks
Labels
💻 Self Hosted only Issues pertaining to self-hosted versions of Maybe 3️⃣ Low priority Contributions accepted, but Maybe team will not be working on this in the near term

Comments

@segleaur
Copy link

segleaur commented Feb 1, 2025

Where did this bug occur? (required)

  • I am a self-hosted user reporting a bug from my self hosted app
  • I am a user of Maybe's paid app

Please note, if you are reporting a bug with sensitive data, please open an Intercom chat from within the app for help

Describe the bug

If a user goes through the "Forgot Password" flow, enters a valid and known email address, clicks on "Reset Password", gets to the confirmation page, however, the password reset email is not sent.

To Reproduce
Steps to reproduce the behavior:

  1. Go to 'Login Page'
  2. Click on 'Forgot Password'
  3. Enter a valid email address of a known user
  4. Click on 'Reset Password'
  5. Expected Password Reset email is not sent.

Expected behavior

The user should receive an email to reset their password.

Screenshots / Recordings

In the Logs, you will see

I, [2025-01-31T23:59:53.503342 #1] INFO -- : [ActiveJob] [ActionMailer::MailDeliveryJob] [xxx] Performing ActionMailer::MailDeliveryJob (Job ID: xxx) from GoodJob(default) enqueued at 2025-01-31T23:59:53.334973727Z with arguments: "PasswordMailer", "password_reset", "deliver_now", {args: [], params: {user: #<GlobalID:0x0 @uri=#<URI::GID gid://maybe/User/xxx>>, token: "xxx"}}
I, [2025-01-31T23:59:53.511952 #1] INFO -- : [ActiveJob] [ActionMailer::MailDeliveryJob] [xxx] Rendered layout layouts/mailer.html.erb (Duration: 3.1ms | GC: 0.0ms)
E, [2025-01-31T23:59:53.513730 #1] ERROR -- : [ActiveJob] [ActionMailer::MailDeliveryJob] [xxx] Error performing ActionMailer::MailDeliveryJob (Job ID: xxx) from GoodJob(default) in 21.38ms: ActionView::Template::Error (Missing host to link to! Please provide the :host parameter, set default_url_options[:host], or set :only_path to true):

@Ezri-Lin
Copy link

Ezri-Lin commented Feb 2, 2025

I am also a self-hosted user and I had the same problem and couldn't receive verification emails when I changed my account email in the new version.

@zachgoll zachgoll added 💻 Self Hosted only Issues pertaining to self-hosted versions of Maybe 3️⃣ Low priority Contributions accepted, but Maybe team will not be working on this in the near term labels Feb 3, 2025
@zachgoll
Copy link
Collaborator

zachgoll commented Feb 3, 2025

In order for self hosted emails to work, you need to configure your instance with the following environment variables and restart it:

  config.action_mailer.default_url_options = { host: ENV["APP_DOMAIN"] }
  config.action_mailer.delivery_method = :smtp
  config.action_mailer.smtp_settings = {
    address:   ENV["SMTP_ADDRESS"],
    port:      ENV["SMTP_PORT"],
    user_name: ENV["SMTP_USERNAME"],
    password:  ENV["SMTP_PASSWORD"],
    tls:       ENV["SMTP_TLS_ENABLED"] == "true"
  }

We likely need to change the UI/UX for this as most self-hosted users will not have this setup by default. It's probably not the correct flow for us to use here.

Thoughts and ideas from the community welcomed here—we won't be able to work on this internally right now due to prioritization.

@villancikos
Copy link

Just to be clear.
One needs to only add the needed environment variables or also that piece of code around somewhere?

@segleaur
Copy link
Author

segleaur commented Feb 3, 2025

As long as these can be documented in the .env - I think the community can help out those that are struggling. The .env.example does have this block (which I do have configured, but might need to update the instructions):

# SMTP Configuration
# This is only needed if you intend on sending emails from your Maybe instance (such as for password resets or email financial reports).
# Resend.com is a good option that offers a free tier for sending emails.
SMTP_ADDRESS=
SMTP_PORT=
SMTP_USERNAME=
SMTP_PASSWORD=
SMTP_TLS_ENABLED=true

# Address that emails are sent from
[email protected]

@villancikos
Copy link

villancikos commented Feb 11, 2025

I made this work. In case someone is wondering how to do it. I am using mailtrap especially but the variables are what matters here.

What did the trick was changing the TLS to False and also adding APP_DOMAIN which is not in the .env.example file.

Also, I don't know if I have to configure EMAIL_SENDER differently.

SMTP_ADDRESS=
SMTP_PORT=
SMTP_USERNAME=
SMTP_PASSWORD=
SMTP_TLS_ENABLED=
[email protected]
APP_DOMAIN=

@tevearitli001
Copy link

tevearitli001 commented Mar 2, 2025

I also filled all the variables @villancikos wrote, but setting TLS to False leads to this error:
ERROR -- : [ActiveJob] [ActionMailer::MailDeliveryJob] [0ce9f103-66d6-40d6-9f39-0ea9e0a0502c] Error performing ActionMailer::MailDeliveryJob (Job ID: 0ce9f103-66d6-40d6-9f39-0ea9e0a0502c) from GoodJob(default) in 5126.3ms: Net::ReadTimeout (Net::ReadTimeout with #<TCPSocket:(closed)>):

and setting it to true leads to this error:
[ActiveJob] [ActionMailer::MailDeliveryJob] [f8caefad-a09a-4c42-b8f5-e922e11fd5f5] Error performing ActionMailer::MailDeliveryJob (Job ID: f8caefad-a09a-4c42-b8f5-e922e11fd5f5) from GoodJob(default) in 64.74ms: OpenSSL::SSL::SSLError (SSL_connect returned=1 errno=0 peeraddr=40.101.92.6:587 state=error: wrong version number):

for information I have force rail SSL to false because I am using a reverse proxy (so I dont need SSL between rails and ly reverse proxy)

thank you for your help !

@nodesocket
Copy link

Would be nice to get this added into the GUI Setings => Self Hosted.

@Toby-Null
Copy link

I also filled all the variables @villancikos wrote, but setting TLS to False leads to this error: ERROR -- : [ActiveJob] [ActionMailer::MailDeliveryJob] [0ce9f103-66d6-40d6-9f39-0ea9e0a0502c] Error performing ActionMailer::MailDeliveryJob (Job ID: 0ce9f103-66d6-40d6-9f39-0ea9e0a0502c) from GoodJob(default) in 5126.3ms: Net::ReadTimeout (Net::ReadTimeout with #<TCPSocket:(closed)>):

and setting it to true leads to this error: [ActiveJob] [ActionMailer::MailDeliveryJob] [f8caefad-a09a-4c42-b8f5-e922e11fd5f5] Error performing ActionMailer::MailDeliveryJob (Job ID: f8caefad-a09a-4c42-b8f5-e922e11fd5f5) from GoodJob(default) in 64.74ms: OpenSSL::SSL::SSLError (SSL_connect returned=1 errno=0 peeraddr=40.101.92.6:587 state=error: wrong version number):

for information I have force rail SSL to false because I am using a reverse proxy (so I dont need SSL between rails and ly reverse proxy)

thank you for your help !

I use self-host with brevo, it doesnt work for me. sadly

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
💻 Self Hosted only Issues pertaining to self-hosted versions of Maybe 3️⃣ Low priority Contributions accepted, but Maybe team will not be working on this in the near term
Projects
None yet
Development

No branches or pull requests

7 participants