getfider / fider

Open platform to collect and prioritize feedback
https://fider.io
GNU Affero General Public License v3.0
2.75k stars 620 forks source link

[BUG] Email not sent from Docker image regardless of using Mailgun or SMTP #1129

Open AlexJFox opened 1 year ago

AlexJFox commented 1 year ago

Fider Cloud or Self Hosted Self Hoster, latest docker image

Describe the bug Will not send emails. have tried SMTP configuration and using mailgun. Email just simply does not leave the docker image.

To Reproduce Steps to reproduce the behavior:

  1. configure docker-compose.yml with necessary email settings
  2. run docker image
  3. fill in Fider registration form and await email

Expected behavior Expect email to arrive

Systems-NYULib commented 1 year ago

We too are experiencing this same issue with our Azure hosted instance which is using AWS SES for mail.

2023-04-14T17:18:56.908014860Z: [INFO] - failed to send email with template signup_email (app/services/email/awsses/awsses.go:122)

muji786 commented 1 year ago

This issue is confirmed by us as well. Preventing us from using the service as people cant sign up

vonsa commented 1 year ago

I tried to set this up in Heroku using either SMTP or Mailgun. Using current version as well as stable. Emails are indeed not being sent, product is unusable.

gulbalee commented 8 months ago

I also get the same issue... Any updates?

 ERROR [2023-10-07T16:26:27Z] [BGW] Error Trace: 
fider-app-1  | - app/middlewares/setup.go:61
fider-app-1  | - goroutine 36 [running]:
fider-app-1  | runtime/debug.Stack()
fider-app-1  |  /usr/local/go/src/runtime/debug/stack.go:24 +0x65
fider-app-1  | github.com/getfider/fider/app/pkg/errors.Panicked({0x1eabe80, 0xc0001738e0})
fider-app-1  |  /server/app/pkg/errors/errors.go:40 +0xcc
fider-app-1  | github.com/getfider/fider/app/middlewares.WorkerSetup.func1.1.2()
fider-app-1  |  /server/app/middlewares/setup.go:61 +0x4a
fider-app-1  | panic({0x1eabe80, 0xc0001738e0})
fider-app-1  |  /usr/local/go/src/runtime/panic.go:838 +0x207
fider-app-1  | github.com/getfider/fider/app/services/email/smtp.sendMail({0x21ccfe8, 0xc0002a4240}, 0xc0001061e0)
fider-app-1  |  /server/app/services/email/smtp/smtp.go:105 +0x146e
fider-app-1  | reflect.Value.call({0x1e8db60?, 0x2023948?, 0x21d2740?}, {0x1f9957d, 0x4}, {0xc000149ca0, 0x2, 0x21d2740?})
fider-app-1  |  /usr/local/go/src/reflect/value.go:556 +0x845
fider-app-1  | reflect.Value.Call({0x1e8db60?, 0x2023948?, 0xc0004ce0c0?}, {0xc000149ca0, 0x2, 0x2})
fider-app-1  |  /usr/local/go/src/reflect/value.go:339 +0xbf
fider-app-1  | github.com/getfider/fider/app/pkg/bus.Publish({0x21ccfe8?, 0xc0002a4240}, {0xc000139d78?, 0x1, 0xc000149d68?})
fider-app-1  |  /server/app/pkg/bus/bus.go:154 +0x46f
fider-app-1  | github.com/getfider/fider/app/tasks.SendSignUpEmail.func1(0x21cccd8?)
fider-app-1  |  /server/app/tasks/signup.go:19 +0x337
fider-app-1  | github.com/getfider/fider/app/middlewares.WorkerSetup.func1.1(0xc0002a4240)
fider-app-1  |  /server/app/middlewares/setup.go:68 +0x363
fider-app-1  | github.com/getfider/fider/app/pkg/worker.(*BackgroundWorker).Run(0xc0000ac880, {0x1fc0a34, 0x1})
fider-app-1  |  /server/app/pkg/worker/worker.go:73 +0x22a
fider-app-1  | created by github.com/getfider/fider/app/pkg/web.(*Engine).Start
fider-app-1  |  /server/app/pkg/web/engine.go:128 +0x71a
fider-app-1  |  (app/pkg/errors/errors.go:40)
fider-app-1  | - github.com/getfider/fider/app/services/email/smtp.sendMail:105 (app/pkg/errors/errors.go:39)
fider-app-1  | - failed to send email with template signup_email (app/services/email/smtp/smtp.go:105)
fider-app-1  | - EOF
fider-app-1  | ERROR [2023-10-07T16:26:27Z] [BGW] Error Trace: 
fider-app-1  | - app/middlewares/setup.go:61
fider-app-1  | - goroutine 36 [running]:
fider-app-1  | runtime/debug.Stack()
fider-app-1  |  /usr/local/go/src/runtime/debug/stack.go:24 +0x65
fider-app-1  | github.com/getfider/fider/app/pkg/errors.Panicked({0x1eabe80, 0xc0001738e0})
fider-app-1  |  /server/app/pkg/errors/errors.go:40 +0xcc
fider-app-1  | github.com/getfider/fider/app/middlewares.WorkerSetup.func1.1.2()
fider-app-1  |  /server/app/middlewares/setup.go:61 +0x4a
fider-app-1  | panic({0x1eabe80, 0xc0001738e0})
fider-app-1  |  /usr/local/go/src/runtime/panic.go:838 +0x207
fider-app-1  | github.com/getfider/fider/app/services/email/smtp.sendMail({0x21ccfe8, 0xc0002a4240}, 0xc0001061e0)
fider-app-1  |  /server/app/services/email/smtp/smtp.go:105 +0x146e
fider-app-1  | reflect.Value.call({0x1e8db60?, 0x2023948?, 0x21d2740?}, {0x1f9957d, 0x4}, {0xc000149ca0, 0x2, 0x21d2740?})
fider-app-1  |  /usr/local/go/src/reflect/value.go:556 +0x845
fider-app-1  | reflect.Value.Call({0x1e8db60?, 0x2023948?, 0xc0004ce0c0?}, {0xc000149ca0, 0x2, 0x2})
fider-app-1  |  /usr/local/go/src/reflect/value.go:339 +0xbf
fider-app-1  | github.com/getfider/fider/app/pkg/bus.Publish({0x21ccfe8?, 0xc0002a4240}, {0xc000139d78?, 0x1, 0xc000149d68?})
fider-app-1  |  /server/app/pkg/bus/bus.go:154 +0x46f
fider-app-1  | github.com/getfider/fider/app/tasks.SendSignUpEmail.func1(0x21cccd8?)
fider-app-1  |  /server/app/tasks/signup.go:19 +0x337
fider-app-1  | github.com/getfider/fider/app/middlewares.WorkerSetup.func1.1(0xc0002a4240)
fider-app-1  |  /server/app/middlewares/setup.go:68 +0x363
fider-app-1  | github.com/getfider/fider/app/pkg/worker.(*BackgroundWorker).Run(0xc0000ac880, {0x1fc0a34, 0x1})
fider-app-1  |  /server/app/pkg/worker/worker.go:73 +0x22a
fider-app-1  | created by github.com/getfider/fider/app/pkg/web.(*Engine).Start
fider-app-1  |  /server/app/pkg/web/engine.go:128 +0x71a
fider-app-1  |  (app/pkg/errors/errors.go:40)
fider-app-1  | - github.com/getfider/fider/app/services/email/smtp.sendMail:105 (app/pkg/errors/errors.go:39)
fider-app-1  | - failed to send email with template signup_email (app/services/email/smtp/smtp.go:105)
fider-app-1  | - EOF
stardeltapower commented 2 months ago

+1

Has anyone been able to fix this issue in a fork?

zzinx58 commented 2 months ago

So sad during the process trying self host, almost spent couple days on this, want to do it on my own.

Cristy94 commented 1 week ago

I tried with both Mailgun and Mailjet, and didn't manage to make it work on one instance.

But on another fider instance, running the stabble/0.21.1 image, same Mailjet credentials seem to work.

What's annoying is that it says send is successful, but no email reaches the Mailjet servers.

mattwoberts commented 1 week ago

Hi all. I'm going to be working on the fider codebase very soon - we've got some ideas for new features so we're going to get it back into an active state!

I'm going to see if I can get anywhere with this - thanks for reporting it and apologies for the wall of silence that you've had so far.

mattwoberts commented 1 week ago

I just tested this on a brand new heroku app instance (using the buildpacks) - I set up mailgun and everything worked (well - the email was sent through to mailgun from fider without issue)

As an aside, I didn't actually get the email - but on looking through mailgun I saw in the logs for my sending domain that I'd not activated my account which is why mailgun hadn't sent it on.

EDIT: Also tried a docker install with fly.io, again using mailgun. This also worked. I'll keep testing some scenarios to see if I can find anything

EDIT2: Also tried a different docker install with fly.io, this time using the SMTP provider in fider. And this also worked.

I wonder if it's something setup related - could there be outbound ports/connections blocked on your setups or something like that?

Cristy94 commented 6 days ago

I just tested this on a brand new heroku app instance (using the buildpacks) - I set up mailgun and everything worked (well - the email was sent through to mailgun from fider without issue)

As an aside, I didn't actually get the email - but on looking through mailgun I saw in the logs for my sending domain that I'd not activated my account which is why mailgun hadn't sent it on.

EDIT: Also tried a docker install with fly.io, again using mailgun. This also worked. I'll keep testing some scenarios to see if I can find anything

EDIT2: Also tried a different docker install with fly.io, this time using the SMTP provider in fider. And this also worked.

I wonder if it's something setup related - could there be outbound ports/connections blocked on your setups or something like that?

I tried with Mailgun, and it seemed that the email was indeed received by Mailgun, (but not delivered due to their authorized domains policies).

Then I tried with Mailjet SMTP, and I couldn't make it work. I tried various ports, asked my hosting provider to allow port 25, but the email still never reached Mailjet. The problem is that in the dashboard it shows that the email was sent:

image

But it never reached Mailjet (can't see it in stats).

Is there any way to debug the email sending?

The exact same settings (same Mailjet SMTP details) work on a different instance, hosted on a different server.

mattwoberts commented 6 days ago

@Cristy94 Have you / are you trying to run it locally - that might give you more information about what's happening? The logs should show you if something goes wrong, but it looks like (as far as fider is concerned) that the email is getting sent OK...

EDIT: Just changed my fly.io instance to use mailjet, and I'm struggling to see anything come through too.... digging...

EDIT 2: It looks like my reply address wasn't a verified sender address so it did actually get through to mailjet but was rejected due to that.

Cristy94 commented 5 days ago

@mattwoberts Even though I have it as verified sender, mine never got through mailjet.

Even though, the logs say this:

2024-06-26T21:53:06.047982270Z INFO [2024-06-26T21:53:06Z] [WEB] POST /api/v1/invitations/sample started
2024-06-26T21:53:06.424857042Z INFO [2024-06-26T21:53:06Z] [WEB] POST /api/v1/invitations/sample finished with 200 in 376ms (committed)

Any idea where/how I can see even more detailed logs? It's very hard to debug, as I don't even know if Fider is using my SMTP settings, it would help to have in the logs at least the service that it's trying to send emails through (Mailgun, SMTP, Amazon SES, etc.)

I am hosting on Hetzner, and I asked them to unlock port 25 too, still no success.

Cristy94 commented 5 days ago

Ok, I found the problem, it was not necessarily Fider related (even though some better logs would help). The DKIM on my domain was not set for Mailjet properly. It's weird that Mailjet doesn't mention this email as rejected or note the problem anywhere.

Once I added the proper mailjet._domainkey TXT record for my domain, I could send the test email (SMTP, Port 25).