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

Return-Path should use no-reply address instead of support email; use only no-reply email or allowed domains in "From" header

    XMLWordPrintable

    Details

    • Testing Instructions:
      Hide

      We want to observe outgoing email from Moodle. The following is my set up. Feel free to use a different setup if you want.

      Setup

      • Create a docker instance for a mail server (Perhaps ask Raj for help if you have trouble).
        • Edited: cleaning reference to outdated document –
      • Create three users using the docker exec command mentioned in the above google doc, that will match a teacher and two students on your moodle site.
      • You will need a teacher and two students on a Moodle site. Enrol only one of the students in a course (student1).
      • Configure Thunderbird to recieve email from all three accounts (teacher and two students).
      • Create a standard forum activity in the course. Set the subscription mode to "Forced subscription" so that everyone is subscribed. Probably a good idea to set the editing time for forum posts to 1 minute [Site administration  ► Security  ► Site policies] -> Maximum time to edit posts.
      • Setup the mail server on Moodle.
      • Go to [Site administration  ► Server  ► E-mail  ► Outgoing mail configuration  ► Email] -> SMTP hosts something like "mail.example.com"
      • Add your email domain to allowed email domains "example.com" (Same page).

      Tests (outbound)

      1. Login is as the student1 and go to the preferences page (click the user menu in the top right corner and select preferences). Then select edit profile.
      2. Make sure that "Email display" is set to "Allow only other course members to see my email address".
      3. Add a post to the forum.
      4. Go to messages [User menu > Messages], find the student who is not enrolled in the same course and send them a message, also send a message to the teacher.
      5. Log out and run the cron (cron is for sending messages for the forum).
      6. Check that emails are sent through. Have a look at the headers:
        • The Return-Path information should have the address as noreply for all of the following checks of the email headers.
        • For the email from student1 to the other student the "From" address should be from noreply.
        • For the email from student1 to the teacher the "From" should include the email address.
      7. Log back in as student1. Change the setting for "Email display" to "Hide my email address from everyone".
      8. Add another post, and send a message again to the other student and teacher.
      9. Log out and run the cron.
      10. Check that emails are sent through. Have a look at the headers:
        • All emails should have the from address of noreply.
      11. Log back in as student1. Change the setting for "Email display" to "Allow everyone to see my email address".
      12. Add another post, and send a message again to the other student and teacher.
      13. Log out and run the cron.
      14. Check that emails are sent through. Have a look at the headers:
        • All emails should have the from address of the email address.
      15. Go to [Site administration  ► Server  ► E-mail  ► Outgoing mail configuration  ► Email] -> allowed email domains and delete all entries (and save).
      16. Log back in as student1.
      17. Add another post, and send a message again to the other student and teacher.
      18. Log out and run the cron.
      19. Check that emails are sent through. Have a look at the headers:
        • All emails should have the from address of noreply.

      Tests (inbound)

      1. Go to [Site administration  ► Server  ► E-mail  ► Incoming mail configuration] and fill in all the fields on this page. (The information here doesn't have to be accurate. We won't actually be testing the forum reply by email feature).
      2. Go to [Site administration  ► Server  ► E-mail  ► message handlers] and change "Reply to forum posts" to Yes.
      3. Go to a forum that the users are subscribed to.
      4. Create a forum post and check "Send forum post notifications with no editing-time delay".
      5. Run the cron.
      6. Go to your email program and check the "reply-to" field. It should be something like {somename}

        +AAAAAIDDksjiJueks9@example.com

      7. Remove all of the domains from "Allowed email domains" and save.
      8. Go and send another forum post.
      9. Run the cron.
      10. Make sure that the "reply-to" field is still something similar to step 6.
      Show
      We want to observe outgoing email from Moodle. The following is my set up. Feel free to use a different setup if you want. Setup Create a docker instance for a mail server (Perhaps ask Raj for help if you have trouble). Edited: cleaning reference to outdated document – Create three users using the docker exec command mentioned in the above google doc, that will match a teacher and two students on your moodle site. You will need a teacher and two students on a Moodle site. Enrol only one of the students in a course (student1). Configure Thunderbird to recieve email from all three accounts (teacher and two students). Create a standard forum activity in the course. Set the subscription mode to "Forced subscription" so that everyone is subscribed. Probably a good idea to set the editing time for forum posts to 1 minute [Site administration  ► Security  ► Site policies] -> Maximum time to edit posts. Setup the mail server on Moodle. Go to [Site administration  ► Server  ► E-mail  ► Outgoing mail configuration  ► Email] -> SMTP hosts something like "mail.example.com" Add your email domain to allowed email domains "example.com" (Same page). Tests (outbound) Login is as the student1 and go to the preferences page (click the user menu in the top right corner and select preferences). Then select edit profile. Make sure that "Email display" is set to "Allow only other course members to see my email address". Add a post to the forum. Go to messages [User menu > Messages] , find the student who is not enrolled in the same course and send them a message, also send a message to the teacher. Log out and run the cron (cron is for sending messages for the forum). Check that emails are sent through. Have a look at the headers: The Return-Path information should have the address as noreply for all of the following checks of the email headers. For the email from student1 to the other student the "From" address should be from noreply. For the email from student1 to the teacher the "From" should include the email address. Log back in as student1. Change the setting for "Email display" to "Hide my email address from everyone". Add another post, and send a message again to the other student and teacher. Log out and run the cron. Check that emails are sent through. Have a look at the headers: All emails should have the from address of noreply. Log back in as student1. Change the setting for "Email display" to "Allow everyone to see my email address". Add another post, and send a message again to the other student and teacher. Log out and run the cron. Check that emails are sent through. Have a look at the headers: All emails should have the from address of the email address. Go to [Site administration  ► Server  ► E-mail  ► Outgoing mail configuration  ► Email] -> allowed email domains and delete all entries (and save). Log back in as student1. Add another post, and send a message again to the other student and teacher. Log out and run the cron. Check that emails are sent through. Have a look at the headers: All emails should have the from address of noreply. Tests (inbound) Go to [Site administration  ► Server  ► E-mail  ► Incoming mail configuration] and fill in all the fields on this page. (The information here doesn't have to be accurate. We won't actually be testing the forum reply by email feature). Go to [Site administration  ► Server  ► E-mail  ► message handlers] and change "Reply to forum posts" to Yes. Go to a forum that the users are subscribed to. Create a forum post and check "Send forum post notifications with no editing-time delay". Run the cron. Go to your email program and check the "reply-to" field. It should be something like {somename} +AAAAAIDDksjiJueks9@example.com Remove all of the domains from "Allowed email domains" and save. Go and send another forum post. Run the cron. Make sure that the "reply-to" field is still something similar to step 6.
    • Affected Branches:
      MOODLE_26_STABLE, MOODLE_29_STABLE, MOODLE_32_STABLE
    • Fixed Branches:
      MOODLE_32_STABLE
    • Pull from Repository:
    • Pull Master Branch:
      wip-MDL-44467-master
    • Sprint:
      3.2 Sprint 7

      Description

      The way the "Return-Path" is set seems to have change lately. This cause us some problem since we have decided to disable Moodle messaging in favor of direct email.

      What happens is that Return-Path is set to the support email address when a teacher sends an email to students. So if for some reason the email can not be delivered, the non-delivery message is sent to support instead of being sent back to the teacher.

      When no support email is set, it uses the email address of the main administrator, which doesn't help.

      In short, when users send email, Return-Path should be set to the sender's email.

      Summary of issue.

      • Return path is set to the no reply address (noreplyaddress).
      • By default the "From" field of outgoing email uses the no reply address.
      • Outgoing mail "From" field contains "via {moodle site}

        " to help with Outlook / Outlook express / Other mail clients saving the no reply address and users having no knowledge that they are replying to a no reply address.

      • The "Allowed email domains" setting takes a list of domains under the control of the institution for sending email. It accepts a wildcard for conveniently adding a lot of domains (*.example.com - tim@first.example.com), or a strict match (example.com - tim@example.com).
      • If allowed domains are set then the user's email address will be used in the "From" and "Reply to" field only in the following situations.
        • The email matches the allowed domains, and the user's setting is to display their email address to everyone.
        • The email matches the allowed domains, and the user's setting is to display their email only to course members, and the email is to be delivered to a course member.
      • All other situations use the no reply address.

      Other changes

      • Email settings related to outgoing email have been moved to "Site administration > Server > Email > Outgoing mail configuration".
      • General notice emails are now sent from the no reply user rather than the support user.
      • Forum setting $CFG->forum_replytouser has been removed and now global $CFG->noreplyaddress is applied also in forum mails.

        Attachments

        1. 0001-Added-setting-to-set-email-return-path-to-From-user-.patch
          4 kB
        2. adminnew.png
          adminnew.png
          24 kB
        3. adminserver.png
          adminserver.png
          22 kB
        4. emailsettings.png
          emailsettings.png
          31 kB
        5. manageauth.png
          manageauth.png
          43 kB
        6. Screen Shot 2016-10-19 at 17.16.48.png
          Screen Shot 2016-10-19 at 17.16.48.png
          38 kB
        7. supportcontact.png
          supportcontact.png
          25 kB

          Issue Links

            Activity

              People

              • Votes:
                21 Vote for this issue
                Watchers:
                25 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:
                  Fix Release Date:
                  5/Dec/16