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

[BUG] SMTP open relay #1158

Open
endquote opened this issue Jan 17, 2024 · 3 comments
Open

[BUG] SMTP open relay #1158

endquote opened this issue Jan 17, 2024 · 3 comments
Labels
good first issue easy and small issues for newcomers type: enhancement make something that is already working even better

Comments

@endquote
Copy link

Fider Cloud or Self Hosted

Self-hosted, getfider/fider:stable image

Describe the bug
A clear and concise description of what the bug is.

My SMTP server is internal to my network and does not require a username/password. Mail does not send with the error:

smtp: server doesn't support AUTH (app/services/email/smtp/smtp.go:131)

To Reproduce

I have EMAIL_SMTP_HOST, EMAIL_NOREPLY, and EMAIL_SMTP_PORT (587) set. I do not have EMAIL_SMTP_USERNAME, EMAIL_SMTP_PASSWORD, or EMAIL_SMTP_ENABLE_STARTTLS set.

Expected behavior

The initial activation email should go out.

Additional context

I set up an earlier version of Fider in this same environment and did have mail go out — so maybe this is a recent bug, or I have an incorrect configuration.

@endquote endquote added the type: bug something is broken, we need to fix it label Jan 17, 2024
@endquote
Copy link
Author

Tried again with EMAIL_SMTP_ENABLE_STARTTLS=true

ERROR [2024-01-17T18:19:05Z] [BGW] Error Trace: 
- app/middlewares/setup.go:61
- goroutine 52 [running]:
runtime/debug.Stack()
	/usr/local/go/src/runtime/debug/stack.go:24 +0x65
github.com/getfider/fider/app/pkg/errors.Panicked({0x1eabe80, 0xc0001c2520})
	/server/app/pkg/errors/errors.go:40 +0xcc
github.com/getfider/fider/app/middlewares.WorkerSetup.func1.1.2()
	/server/app/middlewares/setup.go:61 +0x4a
panic({0x1eabe80, 0xc0001c2520})
	/usr/local/go/src/runtime/panic.go:838 +0x207
github.com/getfider/fider/app/services/email/smtp.sendMail({0x21ccfe8, 0xc0002dc300}, 0xc00010e1e0)
	/server/app/services/email/smtp/smtp.go:105 +0x146e
reflect.Value.call({0x1e8db60?, 0x2023948?, 0x21d2740?}, {0x1f9957d, 0x4}, {0xc000555ca0, 0x2, 0x21d2740?})
	/usr/local/go/src/reflect/value.go:556 +0x845
reflect.Value.Call({0x1e8db60?, 0x2023948?, 0xc0001c8100?}, {0xc000555ca0, 0x2, 0x2})
	/usr/local/go/src/reflect/value.go:339 +0xbf
github.com/getfider/fider/app/pkg/bus.Publish({0x21ccfe8?, 0xc0002dc300}, {0xc0005cdd78?, 0x1, 0xc000555d68?})
	/server/app/pkg/bus/bus.go:154 +0x46f
github.com/getfider/fider/app/tasks.SendSignUpEmail.func1(0x21cccd8?)
	/server/app/tasks/signup.go:19 +0x337
github.com/getfider/fider/app/middlewares.WorkerSetup.func1.1(0xc0002dc300)
	/server/app/middlewares/setup.go:68 +0x363
github.com/getfider/fider/app/pkg/worker.(*BackgroundWorker).Run(0xc00012a8c0, {0x1fc0a33, 0x1})
	/server/app/pkg/worker/worker.go:73 +0x22a
created by github.com/getfider/fider/app/pkg/web.(*Engine).Start
	/server/app/pkg/web/engine.go:128 +0x71a
 (app/pkg/errors/errors.go:40)
- github.com/getfider/fider/app/services/email/smtp.sendMail:105 (app/pkg/errors/errors.go:39)
- failed to send email with template signup_email (app/services/email/smtp/smtp.go:105)
- smtp: server doesn't support AUTH (app/services/email/smtp/smtp.go:131)
INFO [2024-01-17T18:19:05Z] [BGW] Task 'Send sign up email' finished in 120ms (panicked)

@goenning goenning added type: enhancement make something that is already working even better good first issue easy and small issues for newcomers and removed type: bug something is broken, we need to fix it labels Apr 5, 2024
@npham49
Copy link
Contributor

npham49 commented Jul 22, 2024

Hi @mattwoberts,

My previous company also had an open SMTP server; to resolve this issue they did this:
https://github.com/bcgov/nrm-feedback/blob/master/docs/patch/bcgov-notls.patch

I wanted to ask how this solution looked. I was thinking of putting it under a conditional checking if the user provided the SMTP host without Username and Password.

@mattwoberts
Copy link
Contributor

@npham49 yes I think that does make sense, thanks 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue easy and small issues for newcomers type: enhancement make something that is already working even better
Projects
None yet
Development

No branches or pull requests

4 participants