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

Improve the Test outgoing mail configuration admin page

    XMLWordPrintable

Details

    • MOODLE_400_STABLE
    • MOODLE_400_STABLE
    • MDL-71515-master_improve_test_email
    • Easy
    • Hide

      Setup requirements
       
      Please note that you need to configure the Outgoing mail in your site to test this patch. For more information:

      https://docs.moodle.org/311/en/Mail_configuration#Outgoing_mail_configuration

      Note that a real SMTP server is not needed and MailCatcher / MailHog can be used perfectly to test this.
       
      Test the time stamp in subject and email text:
      1.1. Login to the moodle site as a site administrator
      1.2. Navigate to Test outgoing mail configuration: /admin/testoutgoingmailconf.php
      1.3. Enter an email (valid email format e.g. user@domain.edu) in the To email address field.
      1.4. Enter an Additional subject text that you want to get in the subject.
      1.5. Click on Send a test message.
      1.6. Confirm that the email sent, you should get:

      ------------------------------------------------------------------------ 
      From "Admin User (via yoursitename)" <noreply@example.com>
      Subject yoursitename: test message. Sent: 25 June 2021, 5:04:55 AM
      To user@domain.edu
       
      This is a test message to confirm that you have successfully configured
      your site's outgoing mail.
       
      Sent: 25 June 2021, 5:04:55 AM
      ------------------------------------------------------------------------ 
       
       
      Test the Additional subject field:
       
      2.1. Enter an email (valid email format e.g. user@domain.edu) in the To email address field.
      2.2. Enter an Additional subject text that you want to get in the current subject (e.g.: "Additional information."). 
      2.3. Click on Send a test message.
      2.4. Confirm that the email sent, you should get:
      ------------------------------------------------------------------------ 
      From "Admin User (via yoursitename)" <noreply@example.com>
      Subject yoursitename: test message. Additional information. Sent: 25 June 2021, 5:04:55 AM
      To user@domain.edu
      ------------------------------------------------------------------------ 
       
      Test the From field:
       
      Please note that: This field emulates sending the message from that user, but the From header used in the real email sent will depend on other settings such as allowedemaildomains.
       
      Valid username:
      3.1. Enter an email (valid email format e.g. user@domain.edu) in the To email address field.
      3.2. Enter an existing username (e.d. admin ) in the From username or email address field.
      3.3. Click on Send a test message.
      3.4. Confirm that that you get a success notification (notifysuccess) in the same page:
      ------------------------------------------------------------------------ 
      This site has successfully sent a test message to the mail server.
      From: admin@test.com
      To: user@domain.edu
      ------------------------------------------------------------------------ 
       
      Invalid username:
      4.1. Enter an email (valid email format e.g. user@domain.edu) in the To email address field.
      4.2. Enter a non-existent username or random text (e.d. thisisarandomtext ) in the From username or email address field.
      4.3. Click on Send a test message.
      4.4. You will get this form validation error in the Form field: Invalid From username or email. Must be a valid email format or an existing username in Moodle.
      4.5. Please confirm that that the email was not sent.
       
      Valid email format of an existing user:
      5.1. Enter an email (valid email format e.g. user@domain.edu) in the To email address field.
      5.2. Enter an email of an existing user on your site in the From username or email address field.
      5.3. Click on Send a test message.
      5.4. Check the email sent, you should get:
      ------------------------------------------------------------------------ 
      From "First name and Surname of an existing user (via yoursitename)" <noreply@example.com>
      Subject yoursitename: test message. Sent: 25 June 2021, 6:02:34 AM
      To user@domain.edu
      ------------------------------------------------------------------------ 
       
      Valid email format of an non-existent user:
      6.1. Enter an email (valid email format e.g. user@domain.edu) in the To email address field.
      6.2. Enter an email of an non-existent user user on your site in the From username or email address field (e.g. nonexistentuser@domain.edu).
      6.3. Click on Send a test message.
      6.4. Confirm that the email sent, you should get:
      ------------------------------------------------------------------------ 
      From "nonexistentuser@domain.edu (via yoursitename)" <noreply@example.com>
      Subject yoursitename: test message. Sent: 25 June 2021, 6:02:34 AM
      To user@domain.edu
      ------------------------------------------------------------------------ 
       

      Show
      Setup requirements   Please note that you need to configure the Outgoing mail in your site to test this patch. For more information: https://docs.moodle.org/311/en/Mail_configuration#Outgoing_mail_configuration Note that a real SMTP server is not needed and MailCatcher / MailHog can be used perfectly to test this.   Test the time stamp in subject and email text: 1.1. Login to the moodle site as a site administrator 1.2. Navigate to Test outgoing mail configuration: /admin/testoutgoingmailconf.php 1.3. Enter an email (valid email format e.g. user@domain.edu) in the To email address field. 1.4. Enter an Additional subject text that you want to get in the subject. 1.5. Click on Send a test message. 1.6. Confirm that the email sent, you should get: ------------------------------------------------------------------------  From "Admin User (via yoursitename)" <noreply@example.com> Subject yoursitename: test message. Sent: 25 June 2021, 5:04:55 AM To user@domain.edu   This is a test message to confirm that you have successfully configured your site's outgoing mail.   Sent: 25 June 2021, 5:04:55 AM ------------------------------------------------------------------------      Test the Additional subject field:   2.1. Enter an email (valid email format e.g. user@domain.edu) in the To email address field. 2.2. Enter an Additional subject text that you want to get in the current subject (e.g.: "Additional information.").  2.3. Click on Send a test message. 2.4. Confirm that the email sent, you should get: ------------------------------------------------------------------------  From "Admin User (via yoursitename)" <noreply@example.com> Subject yoursitename: test message. Additional information. Sent: 25 June 2021, 5:04:55 AM To user@domain.edu ------------------------------------------------------------------------    Test the From field:   Please note that: This field emulates sending the message from that user, but the From header used in the real email sent will depend on other settings such as allowedemaildomains.   Valid username: 3.1. Enter an email (valid email format e.g. user@domain.edu) in the To email address field. 3.2. Enter an existing username (e.d. admin ) in the From username or email address field. 3.3. Click on Send a test message. 3.4. Confirm that that you get a success notification (notifysuccess) in the same page: ------------------------------------------------------------------------  This site has successfully sent a test message to the mail server. From: admin@test.com To: user@domain.edu ------------------------------------------------------------------------    Invalid username: 4.1. Enter an email (valid email format e.g. user@domain.edu) in the To email address field. 4.2. Enter a non-existent username or random text (e.d. thisisarandomtext ) in the From username or email address field. 4.3. Click on Send a test message. 4.4. You will get this form validation error in the Form field: Invalid From username or email. Must be a valid email format or an existing username in Moodle. 4.5. Please confirm that that the email was not sent.   Valid email format of an existing user: 5.1. Enter an email (valid email format e.g. user@domain.edu) in the To email address field. 5.2. Enter an email of an existing user on your site in the From username or email address field. 5.3. Click on Send a test message. 5.4. Check the email sent, you should get: ------------------------------------------------------------------------  From "First name and Surname of an existing user (via yoursitename)" <noreply@example.com> Subject yoursitename: test message. Sent: 25 June 2021, 6:02:34 AM To user@domain.edu ------------------------------------------------------------------------    Valid email format of an non-existent user: 6.1. Enter an email (valid email format e.g. user@domain.edu) in the To email address field. 6.2. Enter an email of an non-existent user user on your site in the From username or email address field (e.g. nonexistentuser@domain.edu). 6.3. Click on Send a test message. 6.4. Confirm that the email sent, you should get: ------------------------------------------------------------------------  From "nonexistentuser@domain.edu (via yoursitename)" <noreply@example.com> Subject yoursitename: test message. Sent: 25 June 2021, 6:02:34 AM To user@domain.edu ------------------------------------------------------------------------   

    Description

      Whenever I'm debugging email this tool is indispensable - but often I run into things like grey listing, or dkim / spf signing issues etc, and I need to keep changing things downstream and resending emails and retesting. It can be confusing in particular if the emails were delayed for any reason and it's not clear which email belonged to which configuration at a point in time.

      Additionally the signing can change depending on who sent the email.

      So proposing a bunch of small tweaks:

      1) Add a time stamp to the subject and contents of the email so you can easily compare that to the time it was received in your email client

      2) Have an optional from field in the form. This could either accept a username or email and it will send the test email from that moodle user if it matches. This would only be used to match to an account, the actual from email used in the email would go through usual email processing and may be mapped to the noreply user etc - in fact this is exactly what I'd want to test is correct.

      3) Have an optional subject. This would just get tacked onto the existing test email subject not replace it completely, it just serves an easy way to differentiate test emails similar to the date but with more meaning.

       

      Attachments

        Activity

          People

            guillermogomez@catalyst-au.net Guillermo Gomez Arias
            brendanheywood Brendan Heywood
            Brendan Heywood Brendan Heywood
            Eloy Lafuente (stronk7) Eloy Lafuente (stronk7)
            Angelia Dela Cruz Angelia Dela Cruz
            Andrew Lyons, Huong Nguyen, Jun Pataleta, Michael Hawkins, Shamim Rezaie, Simey Lameze, Stevani Andolo, Andrew Lyons, Huong Nguyen, Jun Pataleta, Michael Hawkins, Shamim Rezaie, Simey Lameze, Stevani Andolo
            Votes:
            1 Vote for this issue
            Watchers:
            7 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:
              19/Apr/22

              Time Tracking

                Estimated:
                Original Estimate - 0 minutes
                0m
                Remaining:
                Remaining Estimate - 0 minutes
                0m
                Logged:
                Time Spent - 1 hour, 25 minutes
                1h 25m