Incoming emails not posting


#1

For one of my users new posts via email are not being posted. I have checked the EMAIL admin and I don’t see the emails even listed as rejected. received or skipped, yet I see the email in the inbox of the account its checking.

The only thing I can think of is that the email thats being sent to is just in the CC field and not the TO field.

Any ideas?


#2

I did some digging in the logs and I do see the following logged for that email

Email can not be processed: undefined method `map’


(Matt Palmer) #3

What’s the full error, including the backtrace? What exact version of Discourse are you running?


#4

Thanks for the help. Here are the details you request

Discourse version: v1.7.0.beta10 +130
Email can not be processed: undefined method `map’ for # String:0x007ff8bdb92e50

Backtrace:

/var/www/discourse/vendor/bundle/ruby/2.3.0/gems/logster-1.2.5/lib/logster/logger.rb:76:in `add_with_opts'
/var/www/discourse/vendor/bundle/ruby/2.3.0/gems/logster-1.2.5/lib/logster/logger.rb:37:in `add'
/usr/local/lib/ruby/2.3.0/logger.rb:498:in `warn'
/var/www/discourse/lib/email/processor.rb:107:in `log_email_process_failure'
/var/www/discourse/lib/email/processor.rb:25:in `rescue in process!'
/var/www/discourse/lib/email/processor.rb:15: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.3.0/net/pop.rb:689:in `block in delete_all'
/usr/local/lib/ruby/2.3.0/net/pop.rb:688:in `each'
/usr/local/lib/ruby/2.3.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.3.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'

(Matt Palmer) #5

Can you share (via PM) the raw e-mail that’s failing?


#6

Sure… sent your way


(Matt Palmer) #7

It looks like there is a bug in the mail parsing gem that causes it to get very confused when presented with the kind of crazy-town To: header in the example e-mail you sent. To be clear, the header appears to be valid, it’s just… weird. I’m not overly surprised it’s triggered some corner case in the header parsing. Leave this with me, I’ll figure out how to get this fixed, and probably end up sending a patch to the mail gem.


(Matt Palmer) #8

OK, it’s not a valid To: header. You’ve got one address buried right down deep in the middle of that giant list that looks like this:

Bob Example <BobExample<fcbob@gmail.com>

Which, I’ve just confirmed, is definitely not how the Gods of Internet Mail want address list entries to look.

So, such an e-mail is never going to be accepted by Discourse (or anything else with a modicum of good taste). However, we can certainly do a lot better in surfacing such a problem, and I’ll put together a PR to expose e-mail parse errors in an appropriate manner.


#9

Cool. Can you let me know the specific email that’s wrong?

From a quick glance I can’t quite figure out what’s wrong with the syntax.

Thanks again for your detailed help!!

Joe


(Jeff Atwood) #10

You don’t see the left bracket < ?

Email addresses can’t contain a left bracket…


(Joshua Rosenfeld) #11

I think his issue is that the email is “in the middle of that giant list” - which I would assume makes locating it harder, and thus why he’s asking to be PM’d the specific offending email.


(Jeff Atwood) #12

Oh my bad I see. Bob example :wink:


(Matt Palmer) #13

Indeed, @jomaxro hit the nail on the head. The example e-mail I was sent had a To: field that was some 45 lines long, and the problematic address was at about line 10. It was only the mail gem’s solid error reporting that pointed me in the right direction.


#14

Thanks everyone for the detective work. I did miss the syntax error in the email address… I incorrectly identified the <

Thanks again! Now to fix my email sender!!

Joe