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

Add an inbound message handler for bounced emails and increment users bounce count

    XMLWordPrintable

    Details

    • Type: Improvement
    • Status: Open
    • Priority: Minor
    • Resolution: Unresolved
    • Affects Version/s: 3.1
    • Fix Version/s: None
    • Component/s: Messages
    • Affected Branches:
      MOODLE_31_STABLE
    • Pull Master Branch:
      MDL-53266-verp-bounces
    • Testing Instructions:
      Hide
      1. Setup inbound message processing
      2. Create a user with a working email address and send them an email
      3. Confirm that the Return-Path / noreply email has been overridden with a custom VERP email
      4. Create a user with a broken email address and confirm them manually (Real life use cases are: a user has changed email address, the inbox is full, the email host has gone away etc)
      5. Send an email to them and wait for the bounce to come back (ie watch the VERP mailbox)
      6. Run the pickup cron task and you should see something like this:

      Found 1 messages to parse. Parsing...
      - Parsing message 19
      -- Subject:	Undelivered Mail Returned to Sender
      -- From:	MAILER-DAEMON@smtp.catalyst-au.net
      -- Recipient:	moodle+AAAAAAAAAAQAAAAAAAA4RgAAAAA/mjZ/PA5UCaeWW2gZoQCQ@moodle.catalyst-au.net
      -- Processing the message as user 14406 (teacher).
      -- Validation completed. Fetching rest of message content.
      --> Passing to Inbound Message handler \tool_messageinbound\message\inbound\bounce_handler
      === Increment bounce count to 1 for breefwrwndan+willrogers@catalyst-au.net ===
      

      1. Repeat the above, but between sending the email and running the pickup task change the users email to something else (could be valid or not) and then run the pickup and confirm you see something like this:

      Found 1 messages to parse. Parsing...
      - Parsing message 20
      -- Subject:	Undelivered Mail Returned to Sender
      -- From:	MAILER-DAEMON@smtp.catalyst-au.net
      -- Recipient:	moodle+AAAAAAAAAAQAAAAAAAA4RgAAAAA/mjZ/PA5UCaeWW2gZoQCQ@moodle.catalyst-au.net
      -- Processing the message as user 14406 (teacher).
      -- Validation completed. Fetching rest of message content.
      --> Passing to Inbound Message handler \tool_messageinbound\message\inbound\bounce_handler
      === Bounce message ignored because users email has changed since sent. ===
      

      Show
      Setup inbound message processing Create a user with a working email address and send them an email Confirm that the Return-Path / noreply email has been overridden with a custom VERP email Create a user with a broken email address and confirm them manually (Real life use cases are: a user has changed email address, the inbox is full, the email host has gone away etc) Send an email to them and wait for the bounce to come back (ie watch the VERP mailbox) Run the pickup cron task and you should see something like this: Found 1 messages to parse. Parsing... - Parsing message 19 -- Subject: Undelivered Mail Returned to Sender -- From: MAILER-DAEMON@smtp.catalyst-au.net -- Recipient: moodle+AAAAAAAAAAQAAAAAAAA4RgAAAAA/mjZ/PA5UCaeWW2gZoQCQ@moodle.catalyst-au.net -- Processing the message as user 14406 (teacher). -- Validation completed. Fetching rest of message content. --> Passing to Inbound Message handler \tool_messageinbound\message\inbound\bounce_handler === Increment bounce count to 1 for breefwrwndan+willrogers@catalyst-au.net === Repeat the above, but between sending the email and running the pickup task change the users email to something else (could be valid or not) and then run the pickup and confirm you see something like this: Found 1 messages to parse. Parsing... - Parsing message 20 -- Subject: Undelivered Mail Returned to Sender -- From: MAILER-DAEMON@smtp.catalyst-au.net -- Recipient: moodle+AAAAAAAAAAQAAAAAAAA4RgAAAAA/mjZ/PA5UCaeWW2gZoQCQ@moodle.catalyst-au.net -- Processing the message as user 14406 (teacher). -- Validation completed. Fetching rest of message content. --> Passing to Inbound Message handler \tool_messageinbound\message\inbound\bounce_handler === Bounce message ignored because users email has changed since sent. ===

      Description

      This has been split out from MDL-53255 because it has lots of value by itself, and is a standalone task, and also because it helps implement MDL-53023 more easily for most setups.

      Proposal:

      • If inbound handling is turned on, and the email being sent is from a real user a customnoreply return path will be created.
      • move the existing logic in admin/process_email.php into the inbound handler: consume bounce emails from elsewhere and increment the users bounce count

      The old style bounce processing could happily stay around for a while and not be deprecated, dunno what the vibe is on that but I'd guess that very few instances have it set up.

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              brendanheywood Brendan Heywood
              Reporter:
              brendanheywood Brendan Heywood
              Participants:
              Component watchers:
              Amaia Anabitarte, Carlos Escobedo, Ferran Recio, Ilya Tregubov, Sara Arjona (@sarjona)
              Votes:
              4 Vote for this issue
              Watchers:
              8 Start watching this issue

                Dates

                Created:
                Updated: