Browse Source

Update phpmailer dependency to 6.0

master
Bernhard Fröhlich 1 year ago
parent
commit
a52595cfa7
3 changed files with 58 additions and 66 deletions
  1. 1
    1
      composer.json
  2. 22
    33
      composer.lock
  3. 35
    32
      lib/PhpMonitor/Daemon.php

+ 1
- 1
composer.json View File

@@ -5,7 +5,7 @@
5 5
    "license": "BSD-3-Clause",
6 6
    "require": {
7 7
       "shaneharter/php-daemon": "v2.*",
8
-      "phpmailer/phpmailer": "~5.2",
8
+      "phpmailer/phpmailer": "~6.0",
9 9
       "php": ">=5.5.0",
10 10
       "ext-sockets": "*",
11 11
       "ext-snmp": "*"

+ 22
- 33
composer.lock View File

@@ -4,60 +4,49 @@
4 4
         "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file",
5 5
         "This file is @generated automatically"
6 6
     ],
7
-    "content-hash": "5e49b98b34d715f4aa744f2b41380340",
7
+    "content-hash": "bbcf8f6cf5e4939cf8701cf3507647c8",
8 8
     "packages": [
9 9
         {
10 10
             "name": "phpmailer/phpmailer",
11
-            "version": "v5.2.26",
11
+            "version": "v6.0.5",
12 12
             "source": {
13 13
                 "type": "git",
14 14
                 "url": "https://github.com/PHPMailer/PHPMailer.git",
15
-                "reference": "70362997bda4376378be7d92d81e2200550923f7"
15
+                "reference": "cb3ea134d4d3729e7857737d5f320cce9caf4d32"
16 16
             },
17 17
             "dist": {
18 18
                 "type": "zip",
19
-                "url": "https://api.github.com/repos/PHPMailer/PHPMailer/zipball/70362997bda4376378be7d92d81e2200550923f7",
20
-                "reference": "70362997bda4376378be7d92d81e2200550923f7",
19
+                "url": "https://api.github.com/repos/PHPMailer/PHPMailer/zipball/cb3ea134d4d3729e7857737d5f320cce9caf4d32",
20
+                "reference": "cb3ea134d4d3729e7857737d5f320cce9caf4d32",
21 21
                 "shasum": ""
22 22
             },
23 23
             "require": {
24 24
                 "ext-ctype": "*",
25
-                "php": ">=5.0.0"
25
+                "ext-filter": "*",
26
+                "php": ">=5.5.0"
26 27
             },
27 28
             "require-dev": {
28 29
                 "doctrine/annotations": "1.2.*",
29
-                "jms/serializer": "0.16.*",
30
+                "friendsofphp/php-cs-fixer": "^2.2",
30 31
                 "phpdocumentor/phpdocumentor": "2.*",
31
-                "phpunit/phpunit": "4.8.*",
32
-                "symfony/debug": "2.8.*",
33
-                "symfony/filesystem": "2.8.*",
34
-                "symfony/translation": "2.8.*",
35
-                "symfony/yaml": "2.8.*",
36
-                "zendframework/zend-cache": "2.5.1",
37
-                "zendframework/zend-config": "2.5.1",
38
-                "zendframework/zend-eventmanager": "2.5.1",
39
-                "zendframework/zend-filter": "2.5.1",
40
-                "zendframework/zend-i18n": "2.5.1",
41
-                "zendframework/zend-json": "2.5.1",
42
-                "zendframework/zend-math": "2.5.1",
43
-                "zendframework/zend-serializer": "2.5.*",
44
-                "zendframework/zend-servicemanager": "2.5.*",
45
-                "zendframework/zend-stdlib": "2.5.1"
32
+                "phpunit/phpunit": "^4.8 || ^5.7",
33
+                "zendframework/zend-eventmanager": "3.0.*",
34
+                "zendframework/zend-i18n": "2.7.3",
35
+                "zendframework/zend-serializer": "2.7.*"
46 36
             },
47 37
             "suggest": {
48
-                "league/oauth2-google": "Needed for Google XOAUTH2 authentication"
38
+                "ext-mbstring": "Needed to send email in multibyte encoding charset",
39
+                "hayageek/oauth2-yahoo": "Needed for Yahoo XOAUTH2 authentication",
40
+                "league/oauth2-google": "Needed for Google XOAUTH2 authentication",
41
+                "psr/log": "For optional PSR-3 debug logging",
42
+                "stevenmaguire/oauth2-microsoft": "Needed for Microsoft XOAUTH2 authentication",
43
+                "symfony/polyfill-mbstring": "To support UTF-8 if the Mbstring PHP extension is not enabled (^1.2)"
49 44
             },
50 45
             "type": "library",
51 46
             "autoload": {
52
-                "classmap": [
53
-                    "class.phpmailer.php",
54
-                    "class.phpmaileroauth.php",
55
-                    "class.phpmaileroauthgoogle.php",
56
-                    "class.smtp.php",
57
-                    "class.pop3.php",
58
-                    "extras/EasyPeasyICS.php",
59
-                    "extras/ntlm_sasl_client.php"
60
-                ]
47
+                "psr-4": {
48
+                    "PHPMailer\\PHPMailer\\": "src/"
49
+                }
61 50
             },
62 51
             "notification-url": "https://packagist.org/downloads/",
63 52
             "license": [
@@ -81,7 +70,7 @@
81 70
                 }
82 71
             ],
83 72
             "description": "PHPMailer is a full-featured email creation and transfer class for PHP",
84
-            "time": "2017-11-04T09:26:05+00:00"
73
+            "time": "2018-03-27T13:49:45+00:00"
85 74
         },
86 75
         {
87 76
             "name": "shaneharter/php-daemon",

+ 35
- 32
lib/PhpMonitor/Daemon.php View File

@@ -2,6 +2,8 @@
2 2
 
3 3
 namespace PhpMonitor;
4 4
 
5
+use PHPMailer\PHPMailer\PHPMailer;
6
+
5 7
 
6 8
 class Daemon extends \Core_Daemon
7 9
 {
@@ -96,26 +98,27 @@ class Daemon extends \Core_Daemon
96 98
     {
97 99
         $this->log('Send failure notification for check '.$checkname);
98 100
 
99
-	$mail = new \PHPMailer;
100
-	$mail->isSMTP();
101
-	$mail->Host = Config::get('smtp.host');
102
-	$mail->Port = Config::get('smtp.port');
103
-	$mail->SMTPAuth = true;
104
-	$mail->Username = Config::get('smtp.username');
105
-	$mail->Password = Config::get('smtp.password');
106
-	$mail->SMTPSecure = 'tls';
107
-	$mail->XMailer = ' ';
108
-	$mail->isHTML(false);
109
-	$mail->CharSet = 'UTF-8';
110
-
111
-	foreach($mail->parseAddresses(Config::get('mail.from')) as $addr)
101
+        $mail = new PHPMailer(true);
102
+
103
+        $mail->isSMTP();
104
+        $mail->Host = Config::get('smtp.host');
105
+        $mail->Port = Config::get('smtp.port');
106
+        $mail->SMTPAuth = true;
107
+        $mail->Username = Config::get('smtp.username');
108
+        $mail->Password = Config::get('smtp.password');
109
+        $mail->SMTPSecure = 'tls';
110
+        $mail->XMailer = ' ';
111
+        $mail->isHTML(false);
112
+        $mail->CharSet = 'UTF-8';
113
+
114
+        foreach($mail->parseAddresses(Config::get('mail.from')) as $addr)
112 115
             $mail->setFrom($addr['address'], $addr['name']);
113 116
 
114
-	foreach($mail->parseAddresses(Config::get('mail.to')) as $addr)
117
+        foreach($mail->parseAddresses(Config::get('mail.to')) as $addr)
115 118
             $mail->addAddress($addr['address'], $addr['name']);
116 119
 
117
-	$mail->Subject = 'Check '.$checkname.' failed';
118
-	$mail->Body = sprintf("Check: %s\nURL: %s\nDate: %s\nStatus: %s:\nFailures: %s\n",
120
+        $mail->Subject = 'Check '.$checkname.' failed';
121
+        $mail->Body = sprintf("Check: %s\nURL: %s\nDate: %s\nStatus: %s:\nFailures: %s\n",
119 122
             $checkname, $this->checks[$checkname]['url'], date(DATE_RFC850),
120 123
             $this->checks[$checkname]['status'], $this->checks[$checkname]['failures']);
121 124
 
@@ -126,26 +129,26 @@ class Daemon extends \Core_Daemon
126 129
     {
127 130
         $this->log('Send restore notification for check '.$checkname);
128 131
 
129
-	$mail = new \PHPMailer;
130
-	$mail->isSMTP();
131
-	$mail->Host = Config::get('smtp.host');
132
-	$mail->Port = Config::get('smtp.port');
133
-	$mail->SMTPAuth = true;
134
-	$mail->Username = Config::get('smtp.username');
135
-	$mail->Password = Config::get('smtp.password');
136
-	$mail->SMTPSecure = 'tls';
137
-	$mail->XMailer = ' ';
138
-	$mail->isHTML(false);
139
-	$mail->CharSet = 'UTF-8';
140
-
141
-	foreach($mail->parseAddresses(Config::get('mail.from')) as $addr)
132
+        $mail = new PHPMailer(true);
133
+        $mail->isSMTP();
134
+        $mail->Host = Config::get('smtp.host');
135
+        $mail->Port = Config::get('smtp.port');
136
+        $mail->SMTPAuth = true;
137
+        $mail->Username = Config::get('smtp.username');
138
+        $mail->Password = Config::get('smtp.password');
139
+        $mail->SMTPSecure = 'tls';
140
+        $mail->XMailer = ' ';
141
+        $mail->isHTML(false);
142
+        $mail->CharSet = 'UTF-8';
143
+
144
+        foreach($mail->parseAddresses(Config::get('mail.from')) as $addr)
142 145
             $mail->setFrom($addr['address'], $addr['name']);
143 146
 
144
-	foreach($mail->parseAddresses(Config::get('mail.to')) as $addr)
147
+        foreach($mail->parseAddresses(Config::get('mail.to')) as $addr)
145 148
             $mail->addAddress($addr['address'], $addr['name']);
146 149
 
147
-	$mail->Subject = 'Restored check '.$checkname;
148
-	$mail->Body = sprintf("Check: %s\nURL: %s\nDate: %s\nStatus: %s:\n",
150
+        $mail->Subject = 'Restored check '.$checkname;
151
+        $mail->Body = sprintf("Check: %s\nURL: %s\nDate: %s\nStatus: %s:\n",
149 152
             $checkname, $this->checks[$checkname]['url'], date(DATE_RFC850),
150 153
             $this->checks[$checkname]['status']);
151 154
 

Loading…
Cancel
Save