From b3e3ab2e617585795fa712f52ba8b41d9ca1ebfc Mon Sep 17 00:00:00 2001 From: andryyy Date: Sat, 13 Mar 2021 12:37:24 +0100 Subject: [PATCH] [Web] Allow to specify transport test rcpt --- data/web/inc/ajax/transport_check.php | 8 +++++++- data/web/inc/vars.inc.php | 3 --- data/web/lang/lang.de.json | 2 ++ data/web/lang/lang.en.json | 2 ++ data/web/modals/admin.php | 7 +++++++ 5 files changed, 18 insertions(+), 4 deletions(-) diff --git a/data/web/inc/ajax/transport_check.php b/data/web/inc/ajax/transport_check.php index 79216878..972bdc02 100644 --- a/data/web/inc/ajax/transport_check.php +++ b/data/web/inc/ajax/transport_check.php @@ -15,6 +15,12 @@ if (isset($_SESSION['mailcow_cc_role']) && $_SESSION['mailcow_cc_role'] == "admi else { $mail_from = "relay@example.org"; } + if (isset($_GET['mail_rcpt']) && filter_var($_GET['mail_rcpt'], FILTER_VALIDATE_EMAIL)) { + $mail_rcpt = $_GET['mail_rcpt']; + } + else { + $mail_rcpt = "null@hosted.mailcow.de"; + } if ($transport_type == 'transport-map') { $transport_details = transport('details', $transport_id); $nexthop = $transport_details['nexthop']; @@ -130,7 +136,7 @@ if (isset($_SESSION['mailcow_cc_role']) && $_SESSION['mailcow_cc_role'] == "admi $mail->Port = $port; $mail->setFrom($mail_from, 'Mailer'); $mail->Subject = 'A subject for a SMTP test'; - $mail->addAddress($RELAY_TO, 'Joe Null'); + $mail->addAddress($mail_rcpt, 'Joe Null'); $mail->Body = 'This is our test body'; $mail->send(); } diff --git a/data/web/inc/vars.inc.php b/data/web/inc/vars.inc.php index 09743ec7..fe97537a 100644 --- a/data/web/inc/vars.inc.php +++ b/data/web/inc/vars.inc.php @@ -124,9 +124,6 @@ $SESSION_LIFETIME = 10800; // Label for OTP devices $OTP_LABEL = "mailcow UI"; -// Default "to" address in relay test tool -$RELAY_TO = "null@hosted.mailcow.de"; - // How long to wait (in s) for cURL Docker requests $DOCKER_TIMEOUT = 60; diff --git a/data/web/lang/lang.de.json b/data/web/lang/lang.de.json index 4ae6024d..105dac3f 100644 --- a/data/web/lang/lang.de.json +++ b/data/web/lang/lang.de.json @@ -273,6 +273,7 @@ "regen_api_key": "API-Key regenerieren", "regex_maps": "Regex Maps", "relay_from": "Absenderadresse", + "relay_rcpt": "Empfängeradresse", "relay_run": "Test durchführen", "relayhosts": "Senderabhängige Transport Maps", "relayhosts_hint": "Erstellen Sie senderabhängige Transporte, um diese im Einstellungsdialog einer Domain auszuwählen.
\r\n Der Transporttyp lautet immer \"smtp:\", verwendet TLS wenn angeboten und unterstützt kein wrapped TLS (SMTPS). Benutzereinstellungen bezüglich Verschlüsselungsrichtlinie werden beim Transport berücksichtigt.
\r\n Gilt neben ausgewählter Domain auch für untergeordnete Alias-Domains.", @@ -314,6 +315,7 @@ "transport_dest_format": "Syntax: example.org, .example.org, *, box@example.org (mehrere Werte getrennt durch Komma einzugeben)", "transport_maps": "Transport Maps", "transports_hint": "→ Transport Maps überwiegen senderabhängige Transport Maps.
\r\n→ Transport Maps ignorieren Mailbox-Einstellungen für ausgehende Verschlüsselung. Eine serverweite TLS-Richtlinie wird jedoch angewendet.
\r\n→ Der Transport erfolgt immer via \"smtp:\", verwendet TLS wenn angeboten und unterstützt kein wrapped TLS (SMTPS).
\r\n→ Adressen, die mit \"/localhost$/\" übereinstimmen, werden immer via \"local:\" transportiert, daher sind sie von einer Zieldefinition \"*\" ausgeschlossen.
\r\n→ Die Authentifizierung wird anhand des \"Next hop\" Parameters ermittelt. Hierbei würde bei einem beispielhaften Wert \"[host]:25\" immer zuerst \"host\" abfragt und erst im Anschluss \"[host]:25\". Dieses Verhalten schließt die gleichzeitige Verwendung von Einträgen der Art \"host\" sowie \"[host]:25\" aus.", + "transport_test_rcpt_info": "→ Die Verwendung von null@hosted.mailcow.de testet das Relay gegen ein fremdes Ziel.", "ui_footer": "Footer (HTML zulässig)", "ui_header_announcement": "Ankündigungen", "ui_header_announcement_active": "Ankündigung aktivieren", diff --git a/data/web/lang/lang.en.json b/data/web/lang/lang.en.json index 208b0545..329e891c 100644 --- a/data/web/lang/lang.en.json +++ b/data/web/lang/lang.en.json @@ -271,6 +271,7 @@ "regen_api_key": "Regenerate API key", "regex_maps": "Regex maps", "relay_from": "\"From:\" address", + "relay_rcpt": "\"To:\" address", "relay_run": "Run test", "relayhosts": "Sender-dependent transports", "relayhosts_hint": "Define sender-dependent transports to be able to select them in a domains configuration dialog.
\r\n The transport service is always \"smtp:\" and will therefore try TLS when offered. Wrapped TLS (SMTPS) is not supported. A users individual outbound TLS policy setting is taken into account.
\r\n Affects selected domains including alias domains.", @@ -312,6 +313,7 @@ "transport_dest_format": "Syntax: example.org, .example.org, *, box@example.org (multiple values can be comma-separated)", "transport_maps": "Transport Maps", "transports_hint": "→ A transport map entry overrules a sender-dependent transport map.
\r\n→ Outbound TLS policy settings per-user are ignored and can only be enforced by TLS policy map entries.
\r\n→ The transport service for defined transports is always \"smtp:\" and will therefore try TLS when offered. Wrapped TLS (SMTPS) is not supported.
\r\n→ Addresses matching \"/localhost$/\" will always be transported via \"local:\", therefore a \"*\" destination will not apply to those addresses.
\r\n→ To determine credentials for an exemplary next hop \"[host]:25\", Postfix always queries for \"host\" before searching for \"[host]:25\". This behavior makes it impossible to use \"host\" and \"[host]:25\" at the same time.", + "transport_test_rcpt_info": "→ Use null@hosted.mailcow.de to test relaying to a foreign destination.", "ui_footer": "Footer (HTML allowed)", "ui_header_announcement": "Announcements", "ui_header_announcement_active": "Set announcement active", diff --git a/data/web/modals/admin.php b/data/web/modals/admin.php index e796d2e1..4b090999 100644 --- a/data/web/modals/admin.php +++ b/data/web/modals/admin.php @@ -222,6 +222,13 @@ if (!isset($_SESSION['mailcow_cc_role'])) { +
+ +
+ +

+
+