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

Add a mail filtering and mutation api

    XMLWordPrintable

    Details

    • Type: Improvement
    • Status: Waiting for peer review
    • Priority: Minor
    • Resolution: Unresolved
    • Affects Version/s: 3.10, 4.0
    • Fix Version/s: None
    • Component/s: Email
    • Testing Instructions:
      Hide

      Prerequisites:

      Have a local mail setup installed, such as mailcatcher, to inspect email.

      Install a test tool that will verify the API extension:

       

      git clone git@github.com:Peterburnett/MDL-69724-tester.git admin/emailtester
      

       

      Testing Instructions:

      1) Set the default email settings for messages between users to online and offline here: /admin/message.php

      2) Create a test user to send messages to, which we will use as a test email.

      3) Send a message to this user.

      4) Verify that the email is received in mailcatcher.

      5) Verify that the subject, from and contents all appear as they should.

      6) Edit config.php and add a line to override the mail factory to one that inserts an extra header:

      $CFG->alternative_email_manager_class = '\tool_emailtester\email\manager';
      

      7) Send another message to the test user.

      8) Verify that the mail is received and everything looks the same as in Step 5.

      9) Now inspect the source of the mail, and confirm there is an extra header in the mail: X-mail-testing: test. This confirms that the API extension is working.

       

      Show
      Prerequisites: Have a local mail setup installed, such as mailcatcher, to inspect email. Install a test tool that will verify the API extension:   git clone git @github .com:Peterburnett/MDL- 69724 -tester.git admin/emailtester   Testing Instructions: 1) Set the default email settings for messages between users to online and offline here: /admin/message.php 2) Create a test user to send messages to, which we will use as a test email. 3) Send a message to this user. 4) Verify that the email is received in mailcatcher. 5) Verify that the subject, from and contents all appear as they should. 6) Edit config.php and add a line to override the mail factory to one that inserts an extra header: $CFG->alternative_email_manager_class = '\tool_emailtester\email\manager' ; 7) Send another message to the test user. 8) Verify that the mail is received and everything looks the same as in Step 5. 9) Now inspect the source of the mail, and confirm there is an extra header in the mail: X-mail-testing: test. This confirms that the API extension is working.  
    • Affected Branches:
      MOODLE_310_STABLE, MOODLE_400_STABLE
    • Pull 3.11 Branch:
      MDL-69724-email-mutation-311
    • Pull Master Branch:
      MDL-69724-email-mutation-m

      Description

      Very closely related to MDL-69513 where we add DKIM signing. By moving signing back to the application layer there are a bunch of things traditionally done at the MTA which now need to be done before email signing and so also need to be in the application layer.

      So we need a nice simple api to:

      • potentially filter and turn off certain emails based on their properties (and independent of all the existing
      • opportunity to mutate all emails like conditionally add more header
      • opportunity to change emails
      • opens the door to more use cases like email queueing and logging

      eg we've had a really nice email log / queue / tool which is kinda like mail catcher for a while and makes email a ton nicer and I'll like to make this compatible with Moodle with a clean api:

      https://github.com/catalyst/moodle-local_maillog/tree/TOTARA_12_STABLE

       

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              peterburnett Peter Burnett
              Reporter:
              brendanheywood Brendan Heywood
              Integrator:
              Andrew Nicols
              Participants:
              Component watchers:
              Andrew Nicols, Jun Pataleta, Michael Hawkins, Shamim Rezaie, Simey Lameze
              Votes:
              1 Vote for this issue
              Watchers:
              6 Start watching this issue

                Dates

                Created:
                Updated:

                  Time Tracking

                  Estimated:
                  Original Estimate - Not Specified
                  Not Specified
                  Remaining:
                  Remaining Estimate - 0 minutes
                  0m
                  Logged:
                  Time Spent - 2 hours
                  2h