Uninitialized constant error causes 500 server error with MailGun plugin


(Sander Datema) #1

Case:

  • anonymous user sends mail to group
  • someone from group replies
  • the anonymous user replies from another address
  • mail is bounced, but with a 500 server error

NameError (uninitialized constant Email::Receiver::UserNotSufficientTrustLevelError) /var/www/discourse/plugins/discourse-mailgun/plugin.rb:89:inhandle_failure’`

Of course this is an odd case. It happened because I tested something myself and then used the wrong from address. However, getting a 500 server error because of this is still an odd error.

Edit: I just noticed in that error that it’s the Mailgun plugin that I was using. So forget it. this is not a (confirmed) bug. @andreabedini, could you have a look?


Mailgun plugin for Discourse
Why was this title (see topic) not descriptive enough?
(Andrea Bedini) #2

oh s****, people are using my plugin for real :astonished:. That part (around line 89) was copy and pasted, probably I left out some important part. If you have experience with RoR (I don’t have any actually), would you be able to figure out what’s missing?

Cheers


(Simon Cossar) #3

It looks like the Discourse code (the error classes) changed here:


(Sam Saffron) #4

@zogstrip you probably want to check this out


(Simon Cossar) #5

I think the problem is that the old classes were being called from a plugin.


(Sander Datema) #6

Yep. :slight_smile: I was curious, so I tried it out.


(Andrea Bedini) #7

Yep, sounds like Discourse made come changes. To be honest I don’t have much interest in that plugin anymore. @Sander78 would you be interested in commit access to the github repo?


(Sander Datema) #8

I maybe would give it a go, but didn’t @sam mention somewhere that there’s an API for mails built in already? Can’t find any documentation on it though.


(Andrea Bedini) #9

My understanding is that discourse handle email endpoint requires admin permission while mine is open to everyone. Of course one should check with it’s possible to get mailgun to pass a secret key or something, but I haven’t investigated it yet.


(Julien Grillot) #10

Same error @Sander78 has, using @andreabedini plugin, does somebody found a solution?


(Andrea Bedini) #11

Discourse made some changes back in Feb and the plugin is now broken. PR to fix it are well accepted. I am not using it anymore so it’s not supported.


(Julien Grillot) #12

I redirected e-mail to a Gmail address, then I uses pop3 to poll messages. It works well this way :slight_smile: