Reply to post - Incoming email pickup failed with code '10'

Reply to post - Incoming email pickup failed with code '10'

per Corey Wallis,
Number of replies: 4

Hi,

I'm trying to setup the reply to post functionality in a local development instance of Moodle. 

Emails are being sent when new discussions are added to the forum. Unfortunately replies to these emails are not being processed. 

If I look at the cron log I see the following error:

Execute scheduled task: Incoming email pickup
... started 20:30:42. Current memory use 92.9MB.
Connecting to webmail.dev as moodleadmin...
Connection established.
Searching for Unseen, Unflagged email in the folder 'INBOX'
Found 1 messages to parse. Parsing...
- Parsing message 6
-- Subject:	Re: legendarycourse: Why oh why oh why!
-- From:	student01@webmail.dev
-- Recipient:	moodleadmin+aaaaaaaaaaiaaaaaaaaataaaaaaaaabqxpirl/ks9kwx1nev@webmail.dev
-- Skipped message - it does not appear to relate to a Inbound Message pickup. Fail code 10
... used 2 dbqueries
... used 0.18733692169189 seconds
The thing that is confusing is me is that there does not appear to be a '10' fail code defined. As such I don't know why the message isn't being picked up. 


Has anyone seen this before and successfully resolved the issue? 

Average of ratings: -
In reply to Corey Wallis

Re: Reply to post - Incoming email pickup failed with code '10'

per Andrew Lyons,
Avatar Core developers Avatar Moodle HQ Avatar Particularly helpful Moodlers Avatar Peer reviewers Avatar Plugin developers Avatar Testers

Hi Corey,

So it looks like you've got past the first few hurdles that some are facing (sub-address formatting is often not enabled on some MTAs). So that's a good start.

These fail codes come from lib/classes/message/inbound/address_manager.php and are a bitwise addition of a number of fail codes.

In this case, you have a failcode of 10, which is a bitwise addition of:

  • const VALIDATION_UNKNOWN_HANDLER = 2; and
  • const VALIDATION_UNKNOWN_DATAKEY = 8;

This is a bit of an unusual one. Essentially it looks like the address was generated, but before it was used, something changed about your system - maybe you reset and repeated an upgrade on your test site?

Andrew

In reply to Andrew Lyons

Re: Reply to post - Incoming email pickup failed with code '10'

per Corey Wallis,

Hi Andrew,

Many thanks for the reply. Apologies in the delay in replying to you, I've been caught up with other tasks. 

I can confirm that nothing changed between adding the forum post, Moodle sending the subscription emails, the student replying, and Moodle retrieving the reply.

It is possible that my test email server is breaking the text of the emails in some way, but I'm not sure if this is the case. 

Attached is the raw email message sent to a test student account (student01.gz) and the reply sent from the student account to the mailbox that Moodle is configured to retrieve emails from (moodleadmin.gz).

Could you take a look and see if anything odd jumps out at you?

Otherwise any further thoughts on where I should be looking for what is going wrong?

Many thanks for you assistance. 

-Corey

In reply to Corey Wallis

Re: Reply to post - Incoming email pickup failed with code '10'

per Andrew Lyons,
Avatar Core developers Avatar Moodle HQ Avatar Particularly helpful Moodlers Avatar Peer reviewers Avatar Plugin developers Avatar Testers

Hi Corey,

The first thing that jumps out is lack of case-sensitivity on the local-part of the reply-to address.

You'll notice that the student01 message has an address with localpart:

moodleadmin+AAAAAAAAAAIAAAAAAAAAaAAAAAAAAAACVAqOB2WW3Mz0ckPf

whilst the message received in your moodleadmin file is:

moodleadmin+aaaaaaaaaaiaaaaaaaaaaaaaaaaaaaacvaqob2ww3mz0ckpf

Since these messages are base64 decoded, the case does convey different meaning.

According to RFC-5321,

The local-part of a mailbox MUST BE treated as case sensitive.
Therefore, SMTP implementations MUST take care to preserve the case of mailbox local-parts.

I'd say that this would be the first thing to double-check.

Andrew

In reply to Andrew Lyons

Re: Reply to post - Incoming email pickup failed with code '10'

per Corey Wallis,

Hi Andrew,

Many thanks for your continued support. The webmail application that I was using my development virtual machine was called RainLoop. It was a very nice app. However it applies a lowercase transformation on outgoing email addresses. I've lodged an issue with the project maintainers and they are working on a solution. 

In the meantime I've switched to Roundcube, and I can confirm that everything is working as expected. The issue that I had was caused by the email address being transformed to lowercase.

I'll continue my investigations and hopefully have a patch soon for this MDL-50811 tracker item, which started me down this path. 

With thanks.

-Corey