' . esc_html__('Set up', 'purehost-send-mails') . '');
return $links;
}
public static function url(): string
{
return admin_url('admin.php?page=' . self::SLUG);
}
public const SLUG_EINSTELLUNGEN = 'sendmails-einstellungen';
public static function einstellungenUrl(): string
{
return admin_url('admin.php?page=' . self::SLUG_EINSTELLUNGEN);
}
/** Eigene Seite "Einstellungen" im Menue: API-Schluessel, SMTP, Absender, Bounces und Warteschlange. */
public static function einstellungenSeite(): void
{
ob_start();
try {
self::einstellungenInhalt();
} finally {
echo Ansicht::satzweise((string) ob_get_clean()); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- Seite aus maskierten Teilen, nur
zwischen Saetzen ergaenzt
}
}
private static function einstellungenInhalt(): void
{
if (!current_user_can('manage_options')) {
return;
}
$meldung = get_transient('sendmails_meldung_' . get_current_user_id());
delete_transient('sendmails_meldung_' . get_current_user_id());
$schritte = self::schritte();
echo '
%s
' . esc_html($text) . '
', __('Switch now', 'purehost-send-mails')); } return '' . esc_html(self::fremdHinweis($fremd)) . ' ' /* translators: %s: plugin name */ . esc_html(sprintf(__('Open %s in the plugin list', 'purehost-send-mails'), $fremd)) . '
' . $umstieg . '%s
' . esc_html( $f === 'smtp_passwort' ? __('The stored SMTP password can no longer be read (the security keys in wp-config.php have changed). Please enter it again.', 'purehost-send-mails') : __('The stored API key can no longer be read (the security keys in wp-config.php have changed). Please enter it again.', 'purehost-send-mails') ) . '
' . esc_html__('View all statistics', 'purehost-send-mails') . '
'; } self::warteschlangeAnzeigen(); self::werkzeuge($schritte); self::tools(); echo ''; echo ''; Ansicht::html(Ansicht::marke($s['aktiv'] ? 'ok' : 'aus', $s['aktiv'] ? __('Sending via send-mails.de on', 'purehost-send-mails') : __('Sending via send-mails.de off', 'purehost-send-mails'))); Ansicht::html(Ansicht::marke($s['api'] ? 'ok' : 'fehler', $s['api'] ? __('API connected', 'purehost-send-mails') : __('API not connected', 'purehost-send-mails'))); if ($stand['letzter_lauf'] !== '') { /* translators: %s: date and time */ Ansicht::html(Ansicht::marke($stand['fehler'] === '' ? 'ok' : 'warn', sprintf(__('Sync %s', 'purehost-send-mails'), Ansicht::zeit($stand['letzter_lauf'])))); } if ($wartet > 0) { /* translators: %d: count */ Ansicht::html(Ansicht::marke('warn', sprintf(_n('%d email in the queue', '%d emails in the queue', $wartet, 'purehost-send-mails'), $wartet))); } echo '
'; } private static function formular(string $tun, string $inhalt, string $knopf, string $klasse = 'button-primary'): string { return ''; } /** Einrichtung: jeder Schritt mit eigenem Knopf, der aktuelle offen ("Jetzt dran"). */ private static function ablauf(array $s): void { $titel = [ 'api' => __('Enter API key', 'purehost-send-mails'), 'smtp' => __('Enter SMTP login', 'purehost-send-mails'), 'absender' => __('Set sender address', 'purehost-send-mails'), 'testmail' => __('Send test email', 'purehost-send-mails'), 'aktiv' => __('Turn on sending', 'purehost-send-mails'), ]; $jetzt = array_search(false, $s, true); $erledigt = count(array_filter($s)); $position = array_search($jetzt, array_keys($titel), true) + 1; echo '' . esc_html__('In the customer portal under “API keys”, create a key with the purpose “WordPress plugin” and paste it here. The plugin uses it to set up the SMTP login and sender itself and shows quota, statistics, bounces and complaints.', 'purehost-send-mails') . '
' . self::apiFeld(); case 'smtp': if ((string) Einstellungen::wert('smtp_automatisch') !== '' && Einstellungen::smtpBereit()) { $rest = max(0, (int) Einstellungen::wert('smtp_bereit_ab') - time()); // Countdown: assets/admin.js zaehlt die Zahl in .sm-countdown herunter und laedt die Seite bei 0 neu $hinweis = $rest > 0 ? str_replace('{ZAHL}', '' . $rest . '', esc_html(sprintf( /* translators: %s: seconds (counts down on the page) */ __('Activation takes about %s more seconds. This page then checks the login automatically.', 'purehost-send-mails'), '{ZAHL}'))) : esc_html__('The login is being checked now.', 'purehost-send-mails'); return '' . esc_html__('The SMTP login was created automatically and is being activated.', 'purehost-send-mails') . ' ' . $hinweis . '
' . self::formular('smtp_pruefen', '', __('Check login now', 'purehost-send-mails')) . '' . esc_html__('With an API key for the WordPress plugin, the SMTP login sets itself up. If your key has this permission by now, one click is enough:', 'purehost-send-mails') . '
' . self::formular('einrichten', '', __('Set up automatically with the API key', 'purehost-send-mails')) . '' . esc_html__('In the customer portal under “API keys”, create a key with the purpose “WordPress plugin” and paste it here. The previous key is replaced and setup runs right away.', 'purehost-send-mails') . '
' . self::apiFeld() . '' . esc_html__('Username and password of an SMTP login from the customer portal. The plugin checks the login immediately.', 'purehost-send-mails') . '
' . self::smtpFelder() . ($auto ? '' . esc_html__('send-mails.de only accepts emails from verified domains. WordPress emails with a different sender (such as wordpress@…) get this address. The original one is kept as reply-to address.', 'purehost-send-mails') . '
' . self::absenderFelder(); case 'testmail': return self::testmailFeld(); case 'aktiv': return '' . esc_html__('From now on, all emails from this website go through send-mails.de, including those of the newsletter tools.', 'purehost-send-mails') . '
' . self::formular('einschalten', '', __('Turn on sending', 'purehost-send-mails')); } return ''; } private static function apiFeld(): string { if (Einstellungen::ausKonstante('api_schluessel')) { return '' . esc_html__('The API key is defined in wp-config.php (SENDMAILS_API_SCHLUESSEL).', 'purehost-send-mails') . '
'; } $gespeichert = (string) Einstellungen::wert('api_schluessel') !== ''; return self::formular('api', '', __('Save and check', 'purehost-send-mails')); } /** Zugang per API-Schluessel angelegt (auch aeltere Installationen ohne Kennzeichen: Benutzername wp-k' . esc_html($zustand) . '
' . self::formular('einrichten', '', __('Set up again', 'purehost-send-mails'), 'button-secondary') . '' . esc_html__('Only needed if sending fails with a login error: creates a new password for this website.', 'purehost-send-mails') . '
'; } private static function smtpFelder(): string { $benutzer = Einstellungen::ausKonstante('smtp_benutzer') ? '' . esc_html__('Username from wp-config.php.', 'purehost-send-mails') . '
' : ''; $passwort = Einstellungen::ausKonstante('smtp_passwort') ? '' . esc_html__('Password from wp-config.php.', 'purehost-send-mails') . '
' : ''; return self::formular('smtp', $benutzer . $passwort /* translators: 1: host, 2: port */ . '' . esc_html(sprintf(__('Server %1$s, port %2$d, encrypted.', 'purehost-send-mails'), Einstellungen::smtpHost(), Einstellungen::smtpPort())) . '
', __('Save and check login', 'purehost-send-mails')); } private static function absenderFelder(): string { $email = (string) Einstellungen::wert('absender_email'); [$lokal, $domain] = $email !== '' ? explode('@', $email, 2) + [1 => ''] : ['noreply', '']; $verifiziert = Api::verifizierteDomains() ?? []; if ($verifiziert) { $auswahl = ''; } else { $auswahl = ''; $auswahl .= '' . esc_html__('A different sender for single plugins, e.g. WooCommerce from shop@ and forms from info@. The address must belong to a verified domain. Sources appear here once they have sent an email.', 'purehost-send-mails') . '
'; Ansicht::html(self::formular('absender_regeln', '| ' . esc_html__('Source', 'purehost-send-mails') . ' | ' . esc_html__('Sender address', 'purehost-send-mails') . ' | ' . esc_html__('Display name', 'purehost-send-mails') . ' | ' . esc_html__('Reply-to (optional)', 'purehost-send-mails') . ' |
|---|
' . esc_html(sprintf(__('%s already designs the emails of this website, so this design stays off.', 'purehost-send-mails'), $anderes)) . '
'; return; } echo '' . esc_html__('Plain-text emails get a clean layout with your logo and colour. Emails that already have their own HTML stay unchanged. The original text is kept as text part.', 'purehost-send-mails') . '
'; Ansicht::html(self::formular('design', '' . '
'
. '
' . esc_html__('Preview', 'purehost-send-mails') . ' ↗
'; } /** Mails von WordPress selbst, die sich abschalten lassen. */ private static function systemmailsFelder(): void { $aus = (array) Einstellungen::wert('systemmails_aus'); $felder = ''; foreach (\SendMails\Systemmails::arten() as $schluessel => [$titel, $text]) { $felder .= '
' . esc_html($text) . '
' . esc_html__('Ticked notifications are no longer sent. Emails from plugins are not affected.', 'purehost-send-mails') . '
'; Ansicht::html(self::formular('systemmails', $felder, __('Save', 'purehost-send-mails'), 'button-secondary')); } private static function testmailFeld(string $klasse = 'button-primary'): string { return self::formular('testmail', '', __('Send test email', 'purehost-send-mails'), $klasse); } private static function uebersicht(): void { $st = Api::statistik(); $k = Api::kontingent(); if (!$st['ok'] || !$k['ok']) { echo '' . esc_html($st['ok'] ? $k['fehler'] : $st['fehler']) . '
' . esc_html(sprintf(__('Rates count from %s emails in the period.', 'purehost-send-mails'), Ansicht::zahl($q['mindestmenge'] ?? 200))) . '
'; } echo '' . esc_html(sprintf(__('%1$s handed over · %2$s hard bounces · %3$s complaints', 'purehost-send-mails'), Ansicht::zahl($s['uebergeben'] ?? 0), Ansicht::zahl($s['bounce_hart'] ?? 0), Ansicht::zahl($s['beschwerden'] ?? 0))) . '
'; echo '' . esc_html__('None yet.', 'purehost-send-mails') . '
'; } else { echo '| ' . esc_html__('Time', 'purehost-send-mails') . ' | ' . esc_html__('To', 'purehost-send-mails') . ' | ' . esc_html__('Subject', 'purehost-send-mails') . ' | ' . esc_html__('Source', 'purehost-send-mails') . ' | ' . esc_html__('Status', 'purehost-send-mails') . ' |
|---|---|---|---|---|
| ' . esc_html(Ansicht::zeit((string) $z['zeit'])) . ' | ' . esc_html($an) . ' | ' . esc_html((string) $z['betreff'] !== '' ? (string) $z['betreff'] : '–') . ' | ' . esc_html(Protokoll::name((string) $z['quelle'])) . ' | '; Ansicht::html(Ansicht::marke($art, $text)); echo ' |
' . esc_html__('None yet.', 'purehost-send-mails') . '
'; } else { echo '| ' . esc_html__('Time', 'purehost-send-mails') . ' | ' . esc_html__('Recipient', 'purehost-send-mails') . ' | ' . esc_html__('Reason', 'purehost-send-mails') . ' | ' . esc_html__('In the newsletter tools', 'purehost-send-mails') . ' |
|---|---|---|---|
| ' . esc_html(Ansicht::zeit((string) $e['zeit'])) . ' | ' . esc_html(Testpostfach::anzeige((string) $e['empfaenger'])) . ' | ' . esc_html((string) $e['grund']) . ' | ' . esc_html($wirkung !== '' ? $wirkung : __('not found', 'purehost-send-mails')) . ' |
' . esc_html__('These DNS entries belong to each sender domain. Signature and return path are required, DMARC is recommended. Entries are copied with the button and set at the DNS provider of the domain.', 'purehost-send-mails') . '
'; foreach ($domains as $d) { $eintraege = is_array($d['dns'] ?? null) ? $d['dns'] : null; $offen = $eintraege === null ? 0 : count(array_filter($eintraege, static fn($e) => ($e['status'] ?? '') !== 'ok' && empty($e['empfehlung']))); $empfohlen = $eintraege === null ? 0 : count(array_filter($eintraege, static fn($e) => ($e['status'] ?? '') !== 'ok' && ($e['status'] ?? '') !== 'nicht_noetig' && !empty($e['empfehlung']))); $verifiziert = ($d['status'] ?? '') === 'verifiziert'; $kopf = '' . esc_html((string) $d['domain']) . ' ' . Ansicht::marke($verifiziert ? 'ok' : 'warn', $verifiziert ? __('verified', 'purehost-send-mails') : __('not verified', 'purehost-send-mails')) . ((string) $d['domain'] === $absender ? ' ' . esc_html__('sender of this website', 'purehost-send-mails') . '' : '') . ' ' . esc_html($eintraege === null ? __('DNS entries appear as soon as the domain is set up.', 'purehost-send-mails') : ($offen > 0 /* translators: %d: number of DNS entries */ ? sprintf(_n('%d entry missing or different', '%d entries missing or different', $offen, 'purehost-send-mails'), $offen) : ($empfohlen > 0 ? __('all required entries found, recommendation open', 'purehost-send-mails') : __('all entries found', 'purehost-send-mails')))) . ''; echo '| ' . esc_html__('Purpose', 'purehost-send-mails') . ' | ' . esc_html__('Type', 'purehost-send-mails') . ' | ' . esc_html__('Name', 'purehost-send-mails') . ' | ' . esc_html__('Value', 'purehost-send-mails') . ' | ' . esc_html__('Status', 'purehost-send-mails') . ' |
|---|---|---|---|---|
| ' . esc_html($zwecke[$e['zweck'] ?? ''] ?? (string) ($e['zweck'] ?? '')) . ' | ' . esc_html((string) ($e['typ'] ?? '')) . ' | ' . esc_html((string) ($e['name'] ?? '')) . ' | '
. esc_html($wert) . ' ';
if (!empty($e['gefunden']) && $status !== 'ok') {
/* translators: %s: DNS value found */
echo '' . esc_html(sprintf(__('found: %s', 'purehost-send-mails'), (string) $e['gefunden'])) . ''; } if (!empty($e['hinweis']) && $status !== 'ok') { echo ' ' . esc_html((string) $e['hinweis']) . ''; } echo ' | '; Ansicht::html(Ansicht::marke($art, $text)); echo ' |
' . esc_html(sprintf( /* translators: 1: plugin name, 2: emails in one hour, 3: usual maximum */ __('%1$s sent %2$d emails within one hour, usually at most %3$d. This often means that bots are abusing a form. To protect your domain and your quota, further emails from this source are held.', 'purehost-send-mails'), $name, (int) ($b['stunde'] ?? 0), (int) ($b['grenze'] ?? 0))) . '
' . esc_html(sprintf( /* translators: 1: count, 2: date and time */ _n('%1$d email waiting since %2$s.', '%1$d emails waiting since %2$s.', (int) $b['mails'], 'purehost-send-mails'), (int) $b['mails'], Ansicht::zeit((string) $b['erste']))) . ' ' . '' . esc_html__('Show emails', 'purehost-send-mails') . '
' . esc_html__('send-mails.de could not accept these emails temporarily. The plugin retries automatically for up to 24 hours.', 'purehost-send-mails') . '
'; echo '| ' . esc_html__('Queued', 'purehost-send-mails') . ' | ' . esc_html__('To', 'purehost-send-mails') . ' | ' . esc_html__('Subject', 'purehost-send-mails') . ' | ' . esc_html__('Attempts', 'purehost-send-mails') . ' | ' . esc_html__('Status', 'purehost-send-mails') . ' | ' . esc_html__('Last error', 'purehost-send-mails') . ' |
|---|---|---|---|---|---|
| ' . esc_html(Ansicht::zeit((string) $z['erstellt'])) . ' | ' . esc_html($z['an']) . ' | ' . esc_html($z['betreff']) . ' | ' . (int) $z['versuche'] . ' | ' . esc_html($zustand) . ' | ' . esc_html((string) $z['letzter_fehler']) . ' |
' . esc_html($text) . '
' . $inhalt . '' . esc_html__('WordPress then sends emails as it did before the setup. The credentials stay saved.', 'purehost-send-mails') . '
' . esc_html(sprintf( /* translators: %s: list of supported newsletter plugins */ __('No supported newsletter tool active (%s). Emails from WordPress and other plugins still go through send-mails.de.', 'purehost-send-mails'), self::toolNamen() )) . '
'); echo '' . '
'
. esc_html__('Only for administrators. Contents can include personal data and links such as password resets; attachments are never stored.', 'purehost-send-mails') . '
' . sprintf( /* translators: 1: input field count, 2: input field days */ esc_html__('Soft bounces: mark as “bounced” after %1$s soft bounces within %2$s days.', 'purehost-send-mails'), '', '' ) . '
' . '' . esc_html__('Record bounces in:', 'purehost-send-mails') . '
' . $adapter . '
' . implode('' . esc_html(Ansicht::euro($deckelCent)) . '', array_map('esc_html', $teile)) . '
'; } $bereich = '' . esc_html__('The notice on charging the overage is being revised. Please contact support.', 'purehost-send-mails') . '
') . (empty($d['bestaetigung_gueltig']) ? '' : '' . esc_html__('Consent is given for the current price and cost cap. A different cost cap needs a new consent.', 'purehost-send-mails') . '
') . '' . esc_html(sprintf( /* translators: %s: chosen option */ __('“%s” is chosen, but sending stops when the quota is used up until consent for the current price and cost cap is given.', 'purehost-send-mails'), $wahl[$gewaehlt][0] ?? $gewaehlt )) . '
' : ''; echo '' . esc_html(sprintf( /* translators: 1: emails per month, 2: used, 3: percent */ __('Your plan includes %1$s emails per month, %2$s used (%3$d %%).', 'purehost-send-mails'), Ansicht::zahl($d['mails_pro_monat'] ?? 0), Ansicht::zahl($d['verbraucht'] ?? 0), (int) ($d['prozent'] ?? 0) )) . '
'; Ansicht::html($stand . self::formular('kontingent', '' . esc_html__('Our support has set this for your account.', 'purehost-send-mails') . '
' : '') . '
'
. sprintf(
/* translators: %s: input field */
esc_html__('Held from three times the busiest hour of the last 14 days, but not below %s emails per hour and source. Newsletter tools and test emails are never held.', 'purehost-send-mails'),
''
) . '
' . esc_html__('Never held (untick to remove):', 'purehost-send-mails') . '
' . $vertraut . '
'
. esc_html__('Quota at 80 and 100 %, rates close to the limit, held or waiting emails, domain no longer verified.', 'purehost-send-mails') . '
'
. '' . esc_html__('Empty: the administration email address of this website.', 'purehost-send-mails') . '