Send rejection email for unrecognised errors

Yesterday we had an email to Discourse which errored out while processing with:

Unrecognized error type (RuntimeError: ) when processing incoming email

We only found out about this because the user looked on the site for their reply, couldn’t find it, and alerted me. While it did appear in the logs, I don’t check them particularly regularly.

The simplest ‘solution’ to this I see is sending a rejection message to users if there’s been any error during processing, telling them to try again or alert an admin.

Looking at the source, it seems like not sending a message when there’s an unrecognised error is intentional:

While I understand not giving specific information about the error isn’t really possible, Discourse should at least let the user know their email hasn’t been posted so they don’t naively assume it has.

4 Me gusta

What was the actual error? Can you share the error info? @zogstrip any thoughts on this, should we do a better error here?

I think the problem being raised isn’t so much the specific error, so much as who is notified when random unexpected errors occur. Only admins, if they look in the logs, get to see that the delivery has failed; senders just get radio silence:

2 Me gusta

Well yes that is what I meant when I wrote

1 me gusta

Would love to get the email that’s triggering that error as this is the first time I’m seeing it.

2 Me gusta

Claro:

Tipo de error no reconocido (RuntimeError: ) al procesar el correo entrante

Rastreo de la pila:
  /var/www/discourse/lib/discourse.rb:26:in `execute_command'
  /var/www/discourse/lib/upload_creator.rb:137:in `convert_to_jpeg!'
  /var/www/discourse/lib/upload_creator.rb:42:in `block in create_for'
  /var/www/discourse/lib/distributed_mutex.rb:21:in `synchronize'
  /var/www/discourse/lib/distributed_mutex.rb:5:in `synchronize'
  /var/www/discourse/lib/upload_creator.rb:34:in `create_for'
  /var/www/discourse/lib/email/receiver.rb:580:in `block in create_post_with_attachments'
  /var/www/discourse/lib/email/receiver.rb:573:in `each'
  /var/www/discourse/lib/email/receiver.rb:573:in `create_post_with_attachments'
  /var/www/discourse/lib/email/receiver.rb:551:in `create_reply'
  /var/www/discourse/lib/email/receiver.rb:101:in `process_internal'
  /var/www/discourse/lib/email/receiver.rb:50:in `block in process!'
  /var/www/discourse/lib/distributed_mutex.rb:21:in `synchronize'
  /var/www/discourse/lib/distributed_mutex.rb:5:in `synchronize'
  /var/www/discourse/lib/email/receiver.rb:45:in `process!'
  /var/www/discourse/lib/email/processor.rb:17:in `process!'
  /var/www/discourse/lib/email/processor.rb:11:in `process!'
  /var/www/discourse/app/jobs/scheduled/poll_mailbox.rb:25:in `process_popmail'
  /var/www/discourse/app/jobs/scheduled/poll_mailbox.rb:43:in `block (2 levels) in poll_pop3'
  /usr/local/lib/ruby/2.4.0/net/pop.rb:689:in `block in delete_all'
  /usr/local/lib/ruby/2.4.0/net/pop.rb:688:in `each'
  /usr/local/lib/ruby/2.4.0/net/pop.rb:688:in `delete_all'
  /var/www/discourse/app/jobs/scheduled/poll_mailbox.rb:42:in `block in poll_pop3'
  /usr/local/lib/ruby/2.4.0/net/pop.rb:532:in `start'
  /var/www/discourse/app/jobs/scheduled/poll_mailbox.rb:41:in `poll_pop3'
  /var/www/discourse/app/jobs/scheduled/poll_mailbox.rb:16:in `execute'
  /var/www/discourse/app/jobs/base.rb:154:in `block (2 levels) in perform'

Es un error extraño, e intenté reproducirlo con la misma imagen, pero no pude. Cuando el usuario reenvió el correo, funcionó correctamente.

@zogstrip Te enviaré un mensaje privado con los registros completos, incluido el correo original.

Precisamente, y por eso lo he puesto en Contribute > Feature en lugar de Contribute > Bug.

Como usuario que solo usa el correo, quiero que Discourse me avise siempre que mi correo no resulte en una publicación en Discourse, para saber que mis colegas no me están ignorando.

2 Me gusta

Has there been any progress here? I’m willing to submit a PR implementing this if need be.

1 me gusta

@LeoMcA did this error happen recently? Because I can not reproduce it :frowning:

It hasn’t, but we want to ensure it doesn’t happen again.

And to be clear “it” isn’t this specific error, but the problem where an email-in will error out while processing and the user has no idea it hasn’t been posted:

It’s possibly easiest if I explain myself through code. Something like this is the feature I want to add:

https://github.com/LeoMcA/discourse/commit/8a77db9225a75083f6b253d3d885b262b0a96f6f

(To be clear, this doesn’t actually implement the feature - templates, test and such still need to be written, and I’m not even sure if it’s the best way of approaching it - but hopefully it serves as a demonstration.)

3 Me gusta

Sure, PR welcome to handle this case!

2 Me gusta

:tada:

https://github.com/discourse/discourse/pull/4984

5 Me gusta

@LeoMcA what do you think about adding the contact email site setting on the message?

So it will be:

We’re sorry, but your email message to %{destination} (titled %{former_title}) didn’t work.
There was an unrecognized error while processing your email and it wasn’t posted. You should try again, or contact a staff member at %{contact_mail}.

6 Me gusta

A very good idea indeed, but don’t use the contact email, send them to the /about page which can be hard-coded. The contact info is all there.

4 Me gusta

https://github.com/discourse/discourse/pull/4994

5 Me gusta