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

Allow test outgoing mail page to test mail to users

    • Icon: Improvement Improvement
    • Resolution: Unresolved
    • Icon: Minor Minor
    • None
    • 5.0
    • Administration, Email
    • MOODLE_500_STABLE
    • MDL-83880-test-mail-users
    • 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/405/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.

      Confirm page in admin menu:

      1. Login to the Moodle site as a site administrator
      2. Click on Site administration, then Server
      3. Confirm that the a link to the 'Test outgoing mail configuration' page appears in the 'Email' section

      Test with auto detect enabled:

      1. Create a new test user with an email you can test.
      2. Navigate to Test outgoing mail configuration: /admin/testoutgoingmailconf.php
      3. Enter the email of the test user from step 2 in the To email address field.
      4. Check 'Auto detect user'
      5. Click on Send a test message.
      6. Confirm that you get a success message and receive the email.

      Test suspended account:

      1. Suspend the test user from the previous test.
      2. Return to Test outgoing mail configuration: /admin/testoutgoingmailconf.php
      3. Enter the email of the test user in the To email address field.
      4. Check 'Auto detect user'
      5. Click on Send a test message.
      6. Confirm that you get an error message saying the user is suspended and do not receive an email.

      Test with auto detect disabled:

      1. Re-enter the same email of the suspended test user from the previous test.
      2. Uncheck 'Auto detect user'
      3. Click on Send a test message.
      4. Confirm that you get a success message and receive the email.

      Test with email that doesn't belong to a user:

      1. Enter a valid email address that doesn't belong to a user in the To email address field.
      2. Check 'Auto detect user'
      3. Click on Send a test message.
      4. Confirm that you get a success message and receive the email.

      Test invalid email:

      1. Enter an email address that ends with .invalid
      2. Check 'Auto detect user'
      3. Click on Send a test message.
      4. Confirm that the invalid email was accepted by the form and you get an error message saying email is invalid.

      Confirm invalid configuration still shows SMTP output:

      1. Intentionally make the outgoing mail configuration invalid by specifying an invalid port in $CFG->smtphosts or /admin/settings.php?section=outgoingmailconfig
      2. Return to Test outgoing mail configuration: /admin/testoutgoingmailconf.php
      3. Enter a valid email address
      4. Check 'Auto detect user'
      5. Click on Send a test message.
      6. Confirm that you see an error message with SMTP output that includes an error
      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/405/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. Confirm page in admin menu : Login to the Moodle site as a site administrator Click on Site administration, then Server Confirm that the a link to the 'Test outgoing mail configuration' page appears in the 'Email' section Test with auto detect enabled: Create a new test user with an email you can test. Navigate to Test outgoing mail configuration: /admin/testoutgoingmailconf.php Enter the email of the test user from step 2 in the To email address field. Check 'Auto detect user' Click on Send a test message. Confirm that you get a success message and receive the email. Test suspended account: Suspend the test user from the previous test. Return to Test outgoing mail configuration: /admin/testoutgoingmailconf.php Enter the email of the test user in the To email address field. Check 'Auto detect user' Click on Send a test message. Confirm that you get an error message saying the user is suspended and do not receive an email. Test with auto detect disabled: Re-enter the same email of the suspended test user from the previous test. Uncheck 'Auto detect user' Click on Send a test message. Confirm that you get a success message and receive the email. Test with email that doesn't belong to a user: Enter a valid email address that doesn't belong to a user in the To email address field. Check 'Auto detect user' Click on Send a test message. Confirm that you get a success message and receive the email. Test invalid email: Enter an email address that ends with .invalid Check 'Auto detect user' Click on Send a test message. Confirm that the invalid email was accepted by the form and you get an error message saying email is invalid. Confirm invalid configuration still shows SMTP output: Intentionally make the outgoing mail configuration invalid by specifying an invalid port in $CFG->smtphosts or /admin/settings.php?section=outgoingmailconfig Return to Test outgoing mail configuration: /admin/testoutgoingmailconf.php Enter a valid email address Check 'Auto detect user' Click on Send a test message. Confirm that you see an error message with SMTP output that includes an error
    • Hide

      Code verified against automated checks.

      Checked MDL-83880 using repository: https://github.com/bwalkerl/moodle

      More information about this report

      Built on: Wed 04 Dec 2024 12:06:30 AM UTC

      Show
      Code verified against automated checks. Checked MDL-83880 using repository: https://github.com/bwalkerl/moodle main (0 errors / 0 warnings) [branch: MDL-83880-test-mail-users | CI Job ] More information about this report Built on: Wed 04 Dec 2024 12:06:30 AM UTC

      Currently the Test outgoing mail configuration page at /admin/testoutgoingmailconf.php only allows testing to direct email addresses and hardcodes the userid. While this works for testing the majority of the configuration, it doesn't test anything related specifically to users.

      Sending mail to users would allow us to test user specific settings (i.e. suspended users/bounces) and see how emails to users are formatted (HTML etc). 

      There's value in keeping direct emails, so I'm proposing a new field on that page which if checked would attempt to detect users and test sending mail to them.

            benjaminwalker Benjamin Walker
            benjaminwalker Benjamin Walker
            Brendan Heywood Brendan Heywood
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:

                Error rendering 'clockify-timesheets-time-tracking-reports:timer-sidebar'. Please contact your Jira administrators.