__('Sending via send-mails.de', 'purehost-send-mails'), 'test' => [self::class, 'versand']]; $tests['direct']['sendmails_domain'] = ['label' => __('send-mails.de sender domain', 'purehost-send-mails'), 'test' => [self::class, 'domain']]; $tests['direct']['sendmails_warteschlange'] = ['label' => __('send-mails.de queue', 'purehost-send-mails'), 'test' => [self::class, 'warteschlange']]; return $tests; } private static function ergebnis(string $test, string $status, string $label, string $text): array { return [ 'label' => $label, 'status' => $status, 'badge' => ['label' => __('Email', 'purehost-send-mails'), 'color' => $status === 'good' ? 'blue' : ($status === 'critical' ? 'red' : 'orange')], 'description' => '
' . esc_html($text) . '
', 'actions' => '' . esc_html__('Open send-mails.de', 'purehost-send-mails') . '
', 'test' => $test, ]; } public static function versand(): array { $fremd = Versand::fremdesMailPlugin(); if ($fremd !== null) { /* translators: %s: plugin name */ return self::ergebnis('sendmails_versand', 'critical', sprintf(__('%s handles email sending instead of send-mails.de', 'purehost-send-mails'), $fremd), __('Two plugins replace the WordPress mail function. Deactivate the other mail plugin so that emails go through send-mails.de.', 'purehost-send-mails')); } if (!Einstellungen::versandAktiv()) { return self::ergebnis('sendmails_versand', 'recommended', __('Sending via send-mails.de is off', 'purehost-send-mails'), __('WordPress sends emails without send-mails.de. Finish the setup and turn on sending.', 'purehost-send-mails')); } if (Einstellungen::verloreneFelder()) { return self::ergebnis('sendmails_versand', 'critical', __('send-mails.de credentials can no longer be read', 'purehost-send-mails'), __('The security keys in wp-config.php have changed. Enter the API key again.', 'purehost-send-mails')); } $k = Einstellungen::apiSchluessel() !== '' ? Api::kontingentGespeichert() : null; if ($k && $k['ok'] && (($k['daten']['status'] ?? 'aktiv') !== 'aktiv' || !empty($k['daten']['missbrauch_gesperrt']))) { return self::ergebnis('sendmails_versand', 'critical', __('send-mails.de account suspended', 'purehost-send-mails'), __('send-mails.de does not accept emails from this website at the moment. Details are in the customer portal.', 'purehost-send-mails')); } return self::ergebnis('sendmails_versand', 'good', __('Emails are sent via send-mails.de', 'purehost-send-mails'), __('All emails of this website go through send-mails.de, with delivery status, bounce handling and protection against mass sending.', 'purehost-send-mails')); } public static function domain(): array { $absender = strtolower((string) Einstellungen::wert('absender_email')); $domain = substr((string) strrchr($absender, '@'), 1); $verifiziert = Api::bekannteDomains(); if ($domain === '' || $verifiziert === null) { return self::ergebnis('sendmails_domain', 'recommended', __('send-mails.de sender not set up yet', 'purehost-send-mails'), __('Choose a sender address of a domain verified at send-mails.de.', 'purehost-send-mails')); } if (!in_array($domain, $verifiziert, true)) { /* translators: %s: domain */ return self::ergebnis('sendmails_domain', 'critical', sprintf(__('Sender domain %s is not verified', 'purehost-send-mails'), $domain), __('Emails with this sender are not accepted. Check the DNS entries on the send-mails.de page.', 'purehost-send-mails')); } /* translators: %s: domain */ return self::ergebnis('sendmails_domain', 'good', sprintf(__('Sender domain %s is verified', 'purehost-send-mails'), $domain), __('Emails are signed for this domain (DKIM) and bounces go to its return path.', 'purehost-send-mails')); } public static function warteschlange(): array { $angehalten = Bremse::angehalten(); if ($angehalten) { return self::ergebnis('sendmails_warteschlange', 'critical', __('Emails held because of unusually many emails', 'purehost-send-mails'), __('A plugin or theme suddenly sent far more emails than usual. Decide on the send-mails.de page whether to send or discard them.', 'purehost-send-mails')); } $aufgegeben = Warteschlange::anzahl('aufgegeben'); if ($aufgegeben > 0) { /* translators: %d: count */ return self::ergebnis('sendmails_warteschlange', 'recommended', sprintf(_n('%d email could not be delivered', '%d emails could not be delivered', $aufgegeben, 'purehost-send-mails'), $aufgegeben), __('send-mails.de could not accept these emails even after 24 hours. Details are on the send-mails.de page.', 'purehost-send-mails')); } $wartet = Warteschlange::anzahl('wartet'); if ($wartet > 0) { /* translators: %d: count */ return self::ergebnis('sendmails_warteschlange', 'recommended', sprintf(_n('%d email is waiting in the queue', '%d emails are waiting in the queue', $wartet, 'purehost-send-mails'), $wartet), __('The plugin retries automatically for up to 24 hours.', 'purehost-send-mails')); } return self::ergebnis('sendmails_warteschlange', 'good', __('No emails waiting at send-mails.de', 'purehost-send-mails'), __('The local queue is empty.', 'purehost-send-mails')); } /** Abschnitt im Bericht von "Website-Zustand" (zum Kopieren fuer den Support), ohne Zugangsdaten. */ public static function bericht(array $info): array { $o = Einstellungen::alle(); $stand = Abgleich::stand(); $janein = static fn(bool $w): string => $w ? __('yes', 'purehost-send-mails') : __('no', 'purehost-send-mails'); $info['sendmails'] = [ 'label' => 'send-mails.de', 'fields' => [ 'version' => ['label' => __('Version', 'purehost-send-mails'), 'value' => SENDMAILS_VERSION], 'aktiv' => ['label' => __('Sending on', 'purehost-send-mails'), 'value' => $janein(Einstellungen::versandAktiv())], 'api' => ['label' => __('API key set', 'purehost-send-mails'), 'value' => $janein(Einstellungen::apiSchluessel() !== '')], 'absender' => ['label' => __('Sender', 'purehost-send-mails'), 'value' => (string) $o['absender_email']], 'hosts' => ['label' => __('Mail servers', 'purehost-send-mails'), 'value' => (string) count(Einstellungen::smtpHosts())], 'fremd' => ['label' => __('Other mail plugin', 'purehost-send-mails'), 'value' => Versand::fremdesMailPlugin() ?? '–'], 'warteschlange' => ['label' => __('Queue', 'purehost-send-mails'), 'value' => sprintf('%d / %d / %d', Warteschlange::anzahl('wartet'), Warteschlange::anzahl('angehalten'), Warteschlange::anzahl('aufgegeben')), 'debug' => 'wartet/angehalten/aufgegeben'], 'abgleich' => ['label' => __('Last sync', 'purehost-send-mails'), 'value' => (string) $stand['letzter_lauf'] . ($stand['fehler'] !== '' ? ' (' . $stand['fehler'] . ')' : '')], 'bremse' => ['label' => __('Protection against mass sending', 'purehost-send-mails'), 'value' => $o['bremse'] ? (string) (int) $o['bremse_min'] . ' / h' : __('off', 'purehost-send-mails')], 'warnungen' => ['label' => __('Warnings by email', 'purehost-send-mails'), 'value' => $janein((bool) $o['warnungen'])], ], ]; return $info; } }