[Web] Allow to specify transport test rcpt

master
andryyy 2021-03-13 12:37:24 +01:00
parent c79aae2b1e
commit b3e3ab2e61
No known key found for this signature in database
GPG Key ID: 8EC34FF2794E25EF
5 changed files with 18 additions and 4 deletions

View File

@ -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();
}

View File

@ -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;

View File

@ -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.<br>\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.<br>\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 <b>überwiegen</b> senderabhängige Transport Maps.<br>\r\n→ Transport Maps ignorieren Mailbox-Einstellungen für ausgehende Verschlüsselung. Eine serverweite TLS-Richtlinie wird jedoch angewendet.<br>\r\n→ Der Transport erfolgt immer via \"smtp:\", verwendet TLS wenn angeboten und unterstützt kein wrapped TLS (SMTPS).<br>\r\n→ Adressen, die mit \"/localhost$/\" übereinstimmen, werden immer via \"local:\" transportiert, daher sind sie von einer Zieldefinition \"*\" ausgeschlossen.<br>\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 <b>erst im Anschluss</b> \"[host]:25\". Dieses Verhalten schließt die <b>gleichzeitige Verwendung</b> 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",

View File

@ -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.<br>\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.<br>\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 <b>overrules</b> a sender-dependent transport map</b>.<br>\r\n→ Outbound TLS policy settings per-user are ignored and can only be enforced by TLS policy map entries.<br>\r\n→ The transport service for defined transports is always \"smtp:\" and will therefore try TLS when offered. Wrapped TLS (SMTPS) is not supported.<br>\r\n→ Addresses matching \"/localhost$/\" will always be transported via \"local:\", therefore a \"*\" destination will not apply to those addresses.<br>\r\n→ To determine credentials for an exemplary next hop \"[host]:25\", Postfix <b>always</b> 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",

View File

@ -222,6 +222,13 @@ if (!isset($_SESSION['mailcow_cc_role'])) {
<input type="text" class="form-control" name="mail_from" placeholder="relay@example.org">
</div>
</div>
<div class="form-group">
<label class="control-label col-sm-2" for="mail_rcpt"><?=$lang['admin']['relay_rcpt'];?></label>
<div class="col-sm-10">
<input type="text" class="form-control" name="mail_rcpt" placeholder="null@hosted.mailcow.de" value="null@hosted.mailcow.de">
<p class="help-block"><?=$lang['admin']['transport_test_rcpt_info'];?></p>
</div>
</div>
<div class="form-group">
<div class="col-sm-offset-2 col-sm-10">
<button class="btn btn-default" id="test_transport" href="#"><?=$lang['admin']['relay_run'];?></button>