Uploaded image for project: 'Moodle'
  1. Moodle
  2. MDL-53314

Add IMAP debugging config item

    XMLWordPrintable

    Details

    • Testing Instructions:
      Hide
      1. Configure inbounce mail: Home / ► Site administration / ► Server / ► Incoming mail configuration / ► Mail settings
      2. Add $CFG->debugimap =1; into config.php
      3. Run the pickup cron task and see the raw imap commands and responses:

      php admin/tool/task/cli/schedule_task.php  --execute='\tool_messageinbound\task\pickup_task'
      Execute scheduled task: Incoming email pickup (tool_messageinbound\task\pickup_task)
      Connecting to mail.catalyst.net.nz as moodle@moodle.catalyst-au.net...
      ------------------------------
      >> Thu, 03 Mar 2016 22:13:57 +1100
      >> Connection to: imap://mail.catalyst.net.nz:993/
      >> Server connection took 3.1834 seconds.
      S: * OK [CAPABILITY IMAP4rev1 UIDPLUS CHILDREN NAMESPACE THREAD=ORDEREDSUBJECT THREAD=REFERENCES SORT QUOTA IDLE AUTH=PLAIN ACL ACL2=UNION] Courier-IMAP ready. Copyright 1998-2010 Double Precision, Inc.  See COPYING for distribution information.
      1 [AUTHENTICATE Command - method: PLAIN, username: moodle@moodle.catalyst-au.net]
      C: 2 CAPABILITY
      S: * CAPABILITY IMAP4rev1 UIDPLUS CHILDREN NAMESPACE THREAD=ORDEREDSUBJECT THREAD=REFERENCES SORT QUOTA IDLE AUTH=PLAIN ACL ACL2=UNION
      S: 2 OK CAPABILITY completed
      >> Command 2 took 0.0457 seconds.
      Connection established.
      C: 3 LIST "" INBOX
      C: 4 LIST "" tobeconfirmed
      S: * LIST (\Unmarked \HasChildren) "." "INBOX"
      S: 3 OK LIST completed
      >> Command 3 took 0.0437 seconds.
      S: 4 OK LIST completed
      >> Command 4 took 0.0849 seconds.
      Unable to find the 'tobeconfirmed' mailbox - creating it.
      C: 5 CREATE tobeconfirmed
      S: 5 NO Invalid mailbox name.
      >> Command 5 took 0.0419 seconds.
      Unable to connect to IMAP server. Failed with 'IMAP error reported by server.'
      ... used 5 dbqueries
      ... used 3.5641150474548 seconds
      Scheduled task complete: Incoming email pickup (tool_messageinbound\task\pickup_task)
      C: 6 LOGOUT
      S: * BYE Courier-IMAP server shutting down
      S: 6 OK LOGOUT completed
      >> Command 6 took 0.0441 seconds.
      

      Show
      Configure inbounce mail: Home / ► Site administration / ► Server / ► Incoming mail configuration / ► Mail settings Add $CFG->debugimap =1; into config.php Run the pickup cron task and see the raw imap commands and responses: php admin /tool/task/cli/schedule_task .php --execute= '\tool_messageinbound\task\pickup_task' Execute scheduled task: Incoming email pickup (tool_messageinbound\task\pickup_task) Connecting to mail.catalyst.net.nz as moodle@moodle.catalyst-au.net... ------------------------------ >> Thu, 03 Mar 2016 22:13:57 +1100 >> Connection to: imap: //mail .catalyst.net.nz:993/ >> Server connection took 3.1834 seconds. S: * OK [CAPABILITY IMAP4rev1 UIDPLUS CHILDREN NAMESPACE THREAD=ORDEREDSUBJECT THREAD=REFERENCES SORT QUOTA IDLE AUTH=PLAIN ACL ACL2=UNION] Courier-IMAP ready. Copyright 1998-2010 Double Precision, Inc. See COPYING for distribution information. 1 [AUTHENTICATE Command - method: PLAIN, username: moodle@moodle.catalyst-au.net] C: 2 CAPABILITY S: * CAPABILITY IMAP4rev1 UIDPLUS CHILDREN NAMESPACE THREAD=ORDEREDSUBJECT THREAD=REFERENCES SORT QUOTA IDLE AUTH=PLAIN ACL ACL2=UNION S: 2 OK CAPABILITY completed >> Command 2 took 0.0457 seconds. Connection established. C: 3 LIST "" INBOX C: 4 LIST "" tobeconfirmed S: * LIST (\Unmarked \HasChildren) "." "INBOX" S: 3 OK LIST completed >> Command 3 took 0.0437 seconds. S: 4 OK LIST completed >> Command 4 took 0.0849 seconds. Unable to find the 'tobeconfirmed' mailbox - creating it. C: 5 CREATE tobeconfirmed S: 5 NO Invalid mailbox name. >> Command 5 took 0.0419 seconds. Unable to connect to IMAP server. Failed with 'IMAP error reported by server.' ... used 5 dbqueries ... used 3.5641150474548 seconds Scheduled task complete: Incoming email pickup (tool_messageinbound\task\pickup_task) C: 6 LOGOUT S: * BYE Courier-IMAP server shutting down S: 6 OK LOGOUT completed >> Command 6 took 0.0441 seconds.
    • Affected Branches:
      MOODLE_31_STABLE
    • Fixed Branches:
      MOODLE_31_STABLE
    • Pull Master Branch:
      MDL-53314-imap-debugging

      Description

      Essentially the same as the SMTP but for the inbound message.

      When connecting to some email servers you might happen to get errors like the following with Courier (see MDL-53315)

      php admin/tool/task/cli/schedule_task.php  --execute='\tool_messageinbound\task\pickup_task'
      Execute scheduled task: Incoming email pickup (tool_messageinbound\task\pickup_task)
      Connecting to mail.catalyst.net.nz as moodle@moodle.catalyst-au.net...
      Connection established.
      Unable to find the 'tobeconfirmed' mailbox - creating it.
      Unable to connect to IMAP server. Failed with 'IMAP error reported by server.'
      ... used 6 dbqueries
      ... used 3.7367041110992 seconds
      Scheduled task complete: Incoming email pickup (tool_messageinbound\task\pickup_task)
      

      There is no easy way to debug this

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              brendanheywood Brendan Heywood
              Reporter:
              brendanheywood Brendan Heywood
              Peer reviewer:
              cameron1729
              Integrator:
              David Monllaó
              Tester:
              Adrian Greeve
              Participants:
              Component watchers:
              Amaia Anabitarte, Carlos Escobedo, Ferran Recio, Ilya Tregubov, Sara Arjona (@sarjona)
              Votes:
              0 Vote for this issue
              Watchers:
              5 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved:
                Fix Release Date:
                23/May/16