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

Mails send with contactsitesupport form should set replyto and replytoname to the reporter

XMLWordPrintable

    • MOODLE_401_STABLE, MOODLE_402_STABLE, MOODLE_403_STABLE, MOODLE_404_STABLE, MOODLE_405_STABLE
    • MOODLE_405_STABLE
    • MDL-81629-main
    • Hide

      Setup

      In order to test this, you'll need to setup your moodle to send emails and no-reply email set.

      • SMTP configuration: I suggest installing MailCatcher and just add 127.0.0.1:1025 to smtphosts setting in Site administration > Server > Email > Outgoing mail configuration. Still on that page, set No-reply address to a valid email address.
        Note: Ensure the service is running during the test by running the command mailcatcher.
      • Navigate to Site administration > Server > Supportcontact
        • Set Support email
        • Set Support availability to "Available to anyone visiting the site"

      Test contact site support page

      1. Without logging in, click on the  in the footer and then click Contact site support link.
      2. Now fill the form and submit it.
      3. Make sure you are redirected to the Site homepage and see a confirmation message.
      4. Look the MailCatcher page http://127.0.0.1:1080/ in your browser and make sure you have received an email:
        1. Make sure the From email is the same of the no reply address.
        2. Make sure the To email is the same of the support email setting.
        3. Make sure the Subject is "Site support request - [Your Moodle site name]"
        4. Make sure the information in the email body is the same you have entered in the form.
        5. Make sure there is a warning below the subject of the email, which warns you that the user who sent the email was not logged in.
        6. Make sure the Reply-To field of the email header is set to the name and email set in step 2
      5. Now log in as admin.
      6. Go to the contact support page again.
      7. Repeat the test above, the only differences should be that:
        • the Name and Email address are pre-filled and you are not able to edit.
        • you do not see the warning about the user not being logged in between the subject and email lines
      Show
      Setup In order to test this, you'll need to setup your moodle to send emails and no-reply email set. SMTP configuration: I suggest installing MailCatcher and just add 127.0.0.1:1025 to smtphosts setting in Site administration > Server > Email > Outgoing mail configuration. Still on that page, set No-reply address to a valid email address. Note: Ensure the service is running during the test by running the command mailcatcher. Navigate to  Site administration > Server > Supportcontact Set Support email Set Support availability to "Available to anyone visiting the site" Test contact site support page Without logging in, click on the   in the footer and then click  Contact site support  link. Now fill the form and submit it. Make sure  you are redirected to the Site homepage and see a confirmation message. Look the MailCatcher page  http://127.0.0.1:1080/  in your browser and make sure you have received an email: Make sure  the  From  email is the same of the  no reply address. Make sure  the  To  email is the same of the  support email  setting. Make sure  the  Subject is "Site support request - [Your Moodle site name] " Make sure  the information in the email body is the same you have entered in the form. Make sure there is a warning below the subject of the email, which warns you that the user who sent the email was not logged in. Make sure the Reply-To field of the email header is set to the name and email set in step 2 Now log in as admin. Go to the  contact support page  again. Repeat the test above, the only differences should be that: the  Name  and  Email address  are pre-filled and you are not able to edit. you  do not see the warning about the user not being logged in between the subject and email lines

      Suggestion:

      Mails send to the site support with the contactsitesupport form (user/contactsitesupport.php) should set the the fields for replyto and replytoname in the email header to the contact data provided by the user in the form.

      Reasoning:

      Then the site support recieves a mail from an user in most cases the support will want to anwser directly to the user who reported an issue or inquired something through the form. However directly anwsering the email recieved wont work as the mail will be sent from the noreply address of the moodle server. Changing the recipient of the anwser adds avoidable workload on the support staff as the correct recipient of the anwser is already known (in nearly all cases) and can thus be set in advance in the mail header.

      Suggested code change:

      As the form already requires the user to enter an email adress and a name this requires minimal changes to the code in the user/contactsitesupport.php file.

      Just line 60 needs to be changed from:

      if (!email_to_user(core_user::get_support_user(), $from, $subject, $message)) { 

      to:

      if (!email_to_user(core_user::get_support_user(), $from, $subject, $message, '', '', '', true, $data->email, $data->name)) {

      it even fits in the 132 character limit.

       

        1. MDL-81629.png
          456 kB
          Ron Carl Alfon Yu

            njahreis Nikolai Jahreis
            njahreis Nikolai Jahreis
            Paul Holden Paul Holden
            Huong Nguyen Huong Nguyen
            Ron Carl Alfon Yu Ron Carl Alfon Yu
            Votes:
            0 Vote for this issue
            Watchers:
            6 Start watching this issue

              Created:
              Updated:
              Resolved:

                Estimated:
                Original Estimate - 0 minutes
                0m
                Remaining:
                Remaining Estimate - 0 minutes
                0m
                Logged:
                Time Spent - 51 minutes
                51m

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