Uploaded image for project: 'Moodle QA'
  1. Moodle QA
  2. MDLQA-18925 Moodle 4.5 QA
  3. MDLQA-19355

CLONE - Admins can enable Gmail XOauth2 for outgoing and incoming mail

XMLWordPrintable

      This requires admin access, Google credentials

      OAuth setup

      1. Follow OAuth 2 Google service to get the Client Id and Client secret.
      2. Enable Gmail API in the Google Developer console.
      3. Login as admin.
      4. Navigate to Site Administrator > Server >  OAuth 2 services
      5. Create a new Google service called: Gmail - OAUTH2.
      6. Set the Client id and Client secret.
      7. Set the Scopes included in a login request value to: "openid profile email https://mail.google.com" (Without the quote).
      8. Set the Scopes included in a login request for offline access value to: "openid profile email https://mail.google.com" (Without the quote).
      9. Save changes.
      10. Click Connect to a system account and finish it.

      Initial setup - SMTP

      1. Navigate to Site Administrator > Server > Email > Outgoing Mail Configuration.
      2. Set the following value:
        • SMTP hosts: smtp.gmail.com:587
        • SMTP Security: TLS
        • SMTP Auth Type: XOAUTH2
        • OAuth 2 Service: Gmail - OAUTH2
        • SMTP username: The username that was used to connect to Google Developer Console.
      3. Save changes

      Outgoing mail testing

      1. Navigate to Site Administrator > Server > Email > Outgoing Mail Configuration -> Test outgoing mail configuration
      2. To email address: Your email address to receive the test email.
      3. Additional subject: Test email using XOAUTH2
      4. Press Send a test message.
      5. Verify that you will see:  This site has successfully sent a test message to the mail server.
      6. Open your email inbox.
      7. Verify that you will see an email with:
        • Title: [Your site name]: test message. Test email using XOAUTH2
        • Content: This is a test message to confirm that you have successfully configured your site's outgoing mail.

      Initial setup - IMAP

      1. Navigate to Site Administrator > Server > Email > Incoming Mail Configuration.
      2. Set the following value:
        1. Enable incoming mail processing: Checked
        2. Mailbox name: the name before @ sign of your email address (Ex: Your email is abc@gmail.com, the Mailbox name will be: abc)
        3. Email domain: the name after @ sign of your email address. In this case, it will be: gmail.com
        4. Incoming Mail Server: imap.gmail.com
        5. OAuth 2 Service: Gmail - OAUTH2
        6. Username: The username that was used to connect to the Google Developer Console.
      3. Save changes.
      4. Navigate to Site Administrator > Server > Email > Message handlers.
      5. Enable the Email to Private files.

      Incoming mail testing

      1. Create a new tab on your browser called Tab 1.
      2. On Tab 1, click on the User Profile menu > Profile.
      3. Observe the Email address of the admin user. (Example: xyz@gmail.com)
      4. Create a new tab on your browser called Tab 2.
      5. On Tab 2, open the webmail of the Admin's email (Example: https://mail.google.com)
      6. On Tab 1, click on the User Profile menu > Private files.
      7. Verify that you will see: You can also e-mail files as attachments straight to your private files space. 
      8. Copy the email address.
      9. On Tab 2, compose a new email with the following value:
        1. To: The copied email address.
        2. Subject: Test attachment
        3. Content: Attached
        4. Attachment: Attach an image on your machine.
      10. Send the email.
      11. Go to Site administration > Tasks > Scheduled tasks, locate Incoming email pickup task and click "Run now" link
      12. On Tab 1, click on the User Profile menu > Private files.
      13. Verify that you will see the image that you have sent via email.

        1. Incoming mail testing step11.png
          Incoming mail testing step11.png
          51 kB
        2. Incoming mail testing step13.png
          Incoming mail testing step13.png
          26 kB
        3. Incoming mail testing step7.png
          Incoming mail testing step7.png
          24 kB
        4. Initial setup - IMAP 1.png
          Initial setup - IMAP 1.png
          70 kB
        5. Initial setup - IMAP 2.png
          Initial setup - IMAP 2.png
          50 kB
        6. Initial setup - SMTP.png
          Initial setup - SMTP.png
          63 kB
        7. OAuth setup.png
          OAuth setup.png
          48 kB
        8. OAuth setup connect.png
          OAuth setup connect.png
          54 kB
        9. Outgoing mail testing 1.png
          Outgoing mail testing 1.png
          39 kB
        10. Outgoing mail testing 2.png
          Outgoing mail testing 2.png
          52 kB

            ruseler Adriano Ruseler
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved:

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