Allowing anonymous e-mails for private category prevents e-mails from existing users

AI-generated summary

Users reported a bug where enabling “Accept emails from anonymous users with no accounts” for private categories incorrectly rejected emails from existing users, sending rejection notices instead of processing them. Knagis explained that this setting was intended to allow anonymous submissions via the “system” user but should logically also accept emails from registered users without compromising security. He proposed a hypothetical “Accept any e-mail” setting to bypass validations for moderator review. riking acknowledged identifying this logic gap during development. ItsGhost provided a detailed error message (can_create? failed) and a backtrace, while Sander78 confirmed the issue was reproducible. zogstrip suggested updating to the latest version as the issue appeared fixed. Both ItsGhost and Sander78 confirmed the fix worked after updating. Additionally, ItsGhost inquired if the legacy “system posting” functionality was removed by design, to which zogstrip replied that staged accounts now offer superior functionality compared to the old email quoting method.

If I use “Accept emails from anonymous users with no accounts” for a category that only staff has access to it can correctly receive e-mails from anonymous users (they are submitted via the “system” user and a quote tag).

I expected that this accepts e-mails from existing users since it does not reduce the security in any way. Unfortunately it does not - instead a rejection e-mail is sent back to the user.

My use case - as many others I am trying to use Discourse to replace our ticketing system. I have a small script that uses API to retrieve the received e-mails, create new users and change the owner of the posts.

I would actually prefer a setting “Accept any e-mail” - that would set “skip_validations” option both for replies and topic creation - a moderator would then process the posts. The reason is that when a user writes the e-mail he does not get the feedback about unique titles, minimum lengths, permissions etc.

4 « J'aime »

I actually identified this as a potential problem when I wrote the logic, figured I’d wait until someone actually tried it and noticed :wink:

I’ve just had another version of this, only now it appears to not be working for all anonymous users emailing in.

Exact error message is Email can not be processed: can_create? failed

Backtrace if it’s helpful (I’m not really a rails dev)

/var/www/discourse/vendor/bundle/ruby/2.0.0/gems/logster-1.0.1/lib/logster/logger.rb:74:in `add_with_opts'
/var/www/discourse/vendor/bundle/ruby/2.0.0/gems/logster-1.0.1/lib/logster/logger.rb:35:in `add'
/usr/local/lib/ruby/2.0.0/logger.rb:445:in `warn'
/var/www/discourse/app/jobs/scheduled/poll_mailbox.rb:28:in `handle_failure'
/var/www/discourse/app/jobs/scheduled/poll_mailbox.rb:23:in `rescue in process_popmail'
/var/www/discourse/app/jobs/scheduled/poll_mailbox.rb:19:in `process_popmail'
/var/www/discourse/app/jobs/scheduled/poll_mailbox.rb:76:in `block (2 levels) in poll_pop3'
/usr/local/lib/ruby/2.0.0/net/pop.rb:688:in `block in delete_all'
/usr/local/lib/ruby/2.0.0/net/pop.rb:687:in `each'
/usr/local/lib/ruby/2.0.0/net/pop.rb:687:in `delete_all'
/var/www/discourse/app/jobs/scheduled/poll_mailbox.rb:75:in `block in poll_pop3'
/usr/local/lib/ruby/2.0.0/net/pop.rb:531:in `start'
/var/www/discourse/app/jobs/scheduled/poll_mailbox.rb:74:in `poll_pop3'
/var/www/discourse/app/jobs/scheduled/poll_mailbox.rb:15:in `execute'
/var/www/discourse/app/jobs/base.rb:154:in `block (2 levels) in perform'

I did just reproduce this error.

1 « J'aime »

@Knagis, @ItsGhost & @Sander78, can you update to latest and check? I believe this is fixed now.

4 « J'aime »

Updated and everything appears to be working now, just waiting to see if a notification email is sent to the staged user.

Out of interest this only came about because I couldn’t disable staged accounts, has the old functionality of system posting been removed by design?

1 « J'aime »

Yup, staged accounts is much more powerful than quoting emails.

Yep, it seems to work!

1 « J'aime »

This topic was automatically closed after 2 days. New replies are no longer allowed.