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

Add the possibility for self-signed certificates for SMTP mailings via Moodle

    XMLWordPrintable

    Details

    • Type: Improvement
    • Status: Closed
    • Priority: Minor
    • Resolution: Won't Fix
    • Affects Version/s: 3.1
    • Fix Version/s: None
    • Component/s: Messages
    • Labels:
    • Affected Branches:
      MOODLE_31_STABLE

      Description

      If you are using a self-signed certificate for your mailing server - in our case inside intranet - and setup moodle to use that smtp server for emails, it'll fail with the following message:
      lib/moodlelib.php email_to_user(): SMTP connect() failed

      This happens with PHP 5.6 and newer, the details can be read here https://github.com/PHPMailer/PHPMailer/wiki/Troubleshooting

      Proper certificates are a useful protection, inside intranets self-signed certificates should be enough though.

      My current workaround looks like this, added in line 5429 inside lib/moodlelib.php before return $mailer;

      // Some comments here
       
      		$mailer->SMTPOptions = array(
      			'ssl' => array(
      				'verify_peer' => false,
      				'verify_peer_name' => false,
      				'allow_self_signed' => true
      			)
      		);
      

      In my opinion, there should be a setting inside config.php for this and it should be included into core.

        Attachments

          Activity

            People

            • Votes:
              0 Vote for this issue
              Watchers:
              7 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: