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 @@
"license": "BSD-3-Clause",
"require": {
"shaneharter/php-daemon": "v2.*",
"phpmailer/phpmailer": "~5.2",
"phpmailer/phpmailer": "~6.0",
"php": ">=5.5.0",
"ext-sockets": "*",
"ext-snmp": "*"

+ 22
- 33
composer.lock View File

@@ -4,60 +4,49 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file",
"This file is @generated automatically"
],
"content-hash": "5e49b98b34d715f4aa744f2b41380340",
"content-hash": "bbcf8f6cf5e4939cf8701cf3507647c8",
"packages": [
{
"name": "phpmailer/phpmailer",
"version": "v5.2.26",
"version": "v6.0.5",
"source": {
"type": "git",
"url": "https://github.com/PHPMailer/PHPMailer.git",
"reference": "70362997bda4376378be7d92d81e2200550923f7"
"reference": "cb3ea134d4d3729e7857737d5f320cce9caf4d32"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/PHPMailer/PHPMailer/zipball/70362997bda4376378be7d92d81e2200550923f7",
"reference": "70362997bda4376378be7d92d81e2200550923f7",
"url": "https://api.github.com/repos/PHPMailer/PHPMailer/zipball/cb3ea134d4d3729e7857737d5f320cce9caf4d32",
"reference": "cb3ea134d4d3729e7857737d5f320cce9caf4d32",
"shasum": ""
},
"require": {
"ext-ctype": "*",
"php": ">=5.0.0"
"ext-filter": "*",
"php": ">=5.5.0"
},
"require-dev": {
"doctrine/annotations": "1.2.*",
"jms/serializer": "0.16.*",
"friendsofphp/php-cs-fixer": "^2.2",
"phpdocumentor/phpdocumentor": "2.*",
"phpunit/phpunit": "4.8.*",
"symfony/debug": "2.8.*",
"symfony/filesystem": "2.8.*",
"symfony/translation": "2.8.*",
"symfony/yaml": "2.8.*",
"zendframework/zend-cache": "2.5.1",
"zendframework/zend-config": "2.5.1",
"zendframework/zend-eventmanager": "2.5.1",
"zendframework/zend-filter": "2.5.1",
"zendframework/zend-i18n": "2.5.1",
"zendframework/zend-json": "2.5.1",
"zendframework/zend-math": "2.5.1",
"zendframework/zend-serializer": "2.5.*",
"zendframework/zend-servicemanager": "2.5.*",
"zendframework/zend-stdlib": "2.5.1"
"phpunit/phpunit": "^4.8 || ^5.7",
"zendframework/zend-eventmanager": "3.0.*",
"zendframework/zend-i18n": "2.7.3",
"zendframework/zend-serializer": "2.7.*"
},
"suggest": {
"league/oauth2-google": "Needed for Google XOAUTH2 authentication"
"ext-mbstring": "Needed to send email in multibyte encoding charset",
"hayageek/oauth2-yahoo": "Needed for Yahoo XOAUTH2 authentication",
"league/oauth2-google": "Needed for Google XOAUTH2 authentication",
"psr/log": "For optional PSR-3 debug logging",
"stevenmaguire/oauth2-microsoft": "Needed for Microsoft XOAUTH2 authentication",
"symfony/polyfill-mbstring": "To support UTF-8 if the Mbstring PHP extension is not enabled (^1.2)"
},
"type": "library",
"autoload": {
"classmap": [
"class.phpmailer.php",
"class.phpmaileroauth.php",
"class.phpmaileroauthgoogle.php",
"class.smtp.php",
"class.pop3.php",
"extras/EasyPeasyICS.php",
"extras/ntlm_sasl_client.php"
]
"psr-4": {
"PHPMailer\\PHPMailer\\": "src/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
@@ -81,7 +70,7 @@
}
],
"description": "PHPMailer is a full-featured email creation and transfer class for PHP",
"time": "2017-11-04T09:26:05+00:00"
"time": "2018-03-27T13:49:45+00:00"
},
{
"name": "shaneharter/php-daemon",

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

@@ -2,6 +2,8 @@

namespace PhpMonitor;

use PHPMailer\PHPMailer\PHPMailer;


class Daemon extends \Core_Daemon
{
@@ -96,26 +98,27 @@ class Daemon extends \Core_Daemon
{
$this->log('Send failure notification for check '.$checkname);

$mail = new \PHPMailer;
$mail->isSMTP();
$mail->Host = Config::get('smtp.host');
$mail->Port = Config::get('smtp.port');
$mail->SMTPAuth = true;
$mail->Username = Config::get('smtp.username');
$mail->Password = Config::get('smtp.password');
$mail->SMTPSecure = 'tls';
$mail->XMailer = ' ';
$mail->isHTML(false);
$mail->CharSet = 'UTF-8';

foreach($mail->parseAddresses(Config::get('mail.from')) as $addr)
$mail = new PHPMailer(true);

$mail->isSMTP();
$mail->Host = Config::get('smtp.host');
$mail->Port = Config::get('smtp.port');
$mail->SMTPAuth = true;
$mail->Username = Config::get('smtp.username');
$mail->Password = Config::get('smtp.password');
$mail->SMTPSecure = 'tls';
$mail->XMailer = ' ';
$mail->isHTML(false);
$mail->CharSet = 'UTF-8';

foreach($mail->parseAddresses(Config::get('mail.from')) as $addr)
$mail->setFrom($addr['address'], $addr['name']);

foreach($mail->parseAddresses(Config::get('mail.to')) as $addr)
foreach($mail->parseAddresses(Config::get('mail.to')) as $addr)
$mail->addAddress($addr['address'], $addr['name']);

$mail->Subject = 'Check '.$checkname.' failed';
$mail->Body = sprintf("Check: %s\nURL: %s\nDate: %s\nStatus: %s:\nFailures: %s\n",
$mail->Subject = 'Check '.$checkname.' failed';
$mail->Body = sprintf("Check: %s\nURL: %s\nDate: %s\nStatus: %s:\nFailures: %s\n",
$checkname, $this->checks[$checkname]['url'], date(DATE_RFC850),
$this->checks[$checkname]['status'], $this->checks[$checkname]['failures']);

@@ -126,26 +129,26 @@ class Daemon extends \Core_Daemon
{
$this->log('Send restore notification for check '.$checkname);

$mail = new \PHPMailer;
$mail->isSMTP();
$mail->Host = Config::get('smtp.host');
$mail->Port = Config::get('smtp.port');
$mail->SMTPAuth = true;
$mail->Username = Config::get('smtp.username');
$mail->Password = Config::get('smtp.password');
$mail->SMTPSecure = 'tls';
$mail->XMailer = ' ';
$mail->isHTML(false);
$mail->CharSet = 'UTF-8';
foreach($mail->parseAddresses(Config::get('mail.from')) as $addr)
$mail = new PHPMailer(true);
$mail->isSMTP();
$mail->Host = Config::get('smtp.host');
$mail->Port = Config::get('smtp.port');
$mail->SMTPAuth = true;
$mail->Username = Config::get('smtp.username');
$mail->Password = Config::get('smtp.password');
$mail->SMTPSecure = 'tls';
$mail->XMailer = ' ';
$mail->isHTML(false);
$mail->CharSet = 'UTF-8';
foreach($mail->parseAddresses(Config::get('mail.from')) as $addr)
$mail->setFrom($addr['address'], $addr['name']);

foreach($mail->parseAddresses(Config::get('mail.to')) as $addr)
foreach($mail->parseAddresses(Config::get('mail.to')) as $addr)
$mail->addAddress($addr['address'], $addr['name']);

$mail->Subject = 'Restored check '.$checkname;
$mail->Body = sprintf("Check: %s\nURL: %s\nDate: %s\nStatus: %s:\n",
$mail->Subject = 'Restored check '.$checkname;
$mail->Body = sprintf("Check: %s\nURL: %s\nDate: %s\nStatus: %s:\n",
$checkname, $this->checks[$checkname]['url'], date(DATE_RFC850),
$this->checks[$checkname]['status']);


Loading…
Cancel
Save