<?php
/**
- * @file src/Protocol/Email.php
+ * @copyright Copyright (C) 2010-2022, the Friendica project
+ *
+ * @license GNU AGPL version 3 or any later version
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see <https://www.gnu.org/licenses/>.
+ *
*/
+
namespace Friendica\Protocol;
use Friendica\Core\Hook;
use Friendica\Util\Strings;
/**
- * @brief Email class
+ * Email class
*/
class Email
{
$errors = imap_errors();
if (!empty($errors)) {
- Logger::log('IMAP Errors occured: ' . json_encode($errors));
+ Logger::notice('IMAP Errors occured', ['errora' => $errors]);
}
$alerts = imap_alerts();
if (!empty($alerts)) {
- Logger::log('IMAP Alerts occured: ' . json_encode($alerts));
+ Logger::notice('IMAP Alerts occured: ', ['alerts' => $alerts]);
}
return $mbox;
if (!$search1) {
$search1 = [];
} else {
- Logger::log("Found mails from ".$email_addr, Logger::DEBUG);
+ Logger::notice("Found mails from ".$email_addr);
}
$search2 = @imap_search($mbox, 'UNDELETED TO "' . $email_addr . '"', SE_UID);
if (!$search2) {
$search2 = [];
} else {
- Logger::log("Found mails to ".$email_addr, Logger::DEBUG);
+ Logger::notice("Found mails to ".$email_addr);
}
$search3 = @imap_search($mbox, 'UNDELETED CC "' . $email_addr . '"', SE_UID);
if (!$search3) {
$search3 = [];
} else {
- Logger::log("Found mails cc ".$email_addr, Logger::DEBUG);
+ Logger::notice("Found mails cc ".$email_addr);
}
$res = array_unique(array_merge($search1, $search2, $search3));
//$message = '<html><body>' . $html . '</body></html>';
//$message = html2plain($html);
- Logger::log('notifier: email delivery to ' . $addr);
+ Logger::notice('notifier: email delivery to ' . $addr);
mail($addr, $subject, $body, $headers);
}