diff --git a/dev/Remote/Admin/Fetch.js b/dev/Remote/Admin/Fetch.js index 703c09ccb..5d0922ac6 100644 --- a/dev/Remote/Admin/Fetch.js +++ b/dev/Remote/Admin/Fetch.js @@ -168,6 +168,7 @@ class RemoteAdminFetch extends AbstractFetchRemote { OutSecure: oDomain.smtpSecure(), OutShortLogin: oDomain.smtpShortLogin() ? 1 : 0, OutAuth: oDomain.smtpAuth() ? 1 : 0, + OutSetSender: oDomain.smtpSetSender() ? 1 : 0, OutUsePhpMail: oDomain.smtpPhpMail() ? 1 : 0, WhiteList: oDomain.whiteList() diff --git a/dev/View/Popup/Domain.js b/dev/View/Popup/Domain.js index 3c5ea7925..4a02715c6 100644 --- a/dev/View/Popup/Domain.js +++ b/dev/View/Popup/Domain.js @@ -47,6 +47,7 @@ class DomainPopupView extends AbstractViewPopup { smtpSecure: 0, smtpShortLogin: false, smtpAuth: true, + smtpSetSender: false, smtpPhpMail: false, whiteList: '', aliasName: '', @@ -298,6 +299,7 @@ class DomainPopupView extends AbstractViewPopup { this.smtpSecure(oDomain.OutSecure); this.smtpShortLogin(!!oDomain.OutShortLogin); this.smtpAuth(!!oDomain.OutAuth); + this.smtpSetSender(!!oDomain.OutSetSender); this.smtpPhpMail(!!oDomain.OutUsePhpMail); this.whiteList(oDomain.WhiteList); this.aliasName(oDomain.AliasName); @@ -333,6 +335,7 @@ class DomainPopupView extends AbstractViewPopup { this.smtpSecure(0); this.smtpShortLogin(false); this.smtpAuth(true); + this.smtpSetSender(true); this.smtpPhpMail(false); this.whiteList(''); diff --git a/snappymail/v/0.0.0/app/libraries/RainLoop/Actions/Messages.php b/snappymail/v/0.0.0/app/libraries/RainLoop/Actions/Messages.php index 446eacd67..ec894f8e2 100644 --- a/snappymail/v/0.0.0/app/libraries/RainLoop/Actions/Messages.php +++ b/snappymail/v/0.0.0/app/libraries/RainLoop/Actions/Messages.php @@ -1013,6 +1013,9 @@ trait Messages { $oMessage->SetFrom(new \MailSo\Mime\Email( $oFromIdentity->Email(), $oFromIdentity->Name())); + if ($oAccount->Domain()->OutSetSender()) { + $oMessage->SetSender(\MailSo\Mime\Email::Parse($oAccount->Email())); + } } else { diff --git a/snappymail/v/0.0.0/app/libraries/RainLoop/Model/Domain.php b/snappymail/v/0.0.0/app/libraries/RainLoop/Model/Domain.php index 0f8f9c35f..8d75e250e 100644 --- a/snappymail/v/0.0.0/app/libraries/RainLoop/Model/Domain.php +++ b/snappymail/v/0.0.0/app/libraries/RainLoop/Model/Domain.php @@ -58,6 +58,11 @@ class Domain implements \JsonSerializable */ private $bOutAuth; + /** + * @var bool + */ + private $bOutSetSender; + /** * @var bool */ @@ -97,7 +102,8 @@ class Domain implements \JsonSerializable string $sIncHost, int $iIncPort, int $iIncSecure, bool $bIncShortLogin, bool $bUseSieve, string $sSieveHost, int $iSievePort, int $iSieveSecure, string $sOutHost, int $iOutPort, int $iOutSecure, bool $bOutShortLogin, - bool $bOutAuth, bool $bOutUsePhpMail = false, string $sWhiteList = '') + bool $bOutAuth, bool $bOutSetSender, bool $bOutUsePhpMail = false, + string $sWhiteList = '') { $this->sName = $sName; $this->sIncHost = $sIncHost; @@ -110,6 +116,7 @@ class Domain implements \JsonSerializable $this->iOutSecure = $iOutSecure; $this->bOutShortLogin = $bOutShortLogin; $this->bOutAuth = $bOutAuth; + $this->bOutSetSender = $bOutSetSender; $this->bOutUsePhpMail = $bOutUsePhpMail; $this->bUseSieve = $bUseSieve; @@ -145,6 +152,7 @@ class Domain implements \JsonSerializable !empty($aDomain['smtp_secure']) ? $aDomain['smtp_secure'] : ''); $bOutAuth = !empty($aDomain['smtp_auth']); + $bOutSetSender = !empty($aDomain['smtp_set_sender']); $bOutUsePhpMail = !empty($aDomain['smtp_php_mail']); $sWhiteList = (string) ($aDomain['white_list'] ?? ''); @@ -154,7 +162,7 @@ class Domain implements \JsonSerializable $oDomain = new self($sName, $sIncHost, $iIncPort, $iIncSecure, $bIncShortLogin, $bUseSieve, $sSieveHost, $iSievePort, $iSieveSecure, - $sOutHost, $iOutPort, $iOutSecure, $bOutShortLogin, $bOutAuth, $bOutUsePhpMail, + $sOutHost, $iOutPort, $iOutSecure, $bOutShortLogin, $bOutAuth, $bOutSetSender, $bOutUsePhpMail, $sWhiteList); } @@ -206,6 +214,7 @@ class Domain implements \JsonSerializable 'smtp_secure = "'.self::ConstConnectionSecurityTypeToStr($this->iOutSecure).'"', 'smtp_short_login = '.($this->bOutShortLogin ? 'On' : 'Off'), 'smtp_auth = '.($this->bOutAuth ? 'On' : 'Off'), + 'smtp_set_sender = '.($this->bOutSetSender ? 'On' : 'Off'), 'smtp_php_mail = '.($this->bOutUsePhpMail ? 'On' : 'Off'), 'white_list = "'.$this->encodeIniString($this->sWhiteList).'"' )); @@ -246,7 +255,8 @@ class Domain implements \JsonSerializable string $sIncHost, int $iIncPort, int $iIncSecure, bool $bIncShortLogin, bool $bUseSieve, string $sSieveHost, int $iSievePort, int $iSieveSecure, string $sOutHost, int $iOutPort, int $iOutSecure, bool $bOutShortLogin, - bool $bOutAuth, bool $bOutUsePhpMail, string $sWhiteList = '') : self + bool $bOutAuth, bool $bOutSetSender, bool $bOutUsePhpMail, + string $sWhiteList = '') : self { $this->sIncHost = \MailSo\Base\Utils::IdnToAscii($sIncHost); $this->iIncPort = $iIncPort; @@ -263,6 +273,7 @@ class Domain implements \JsonSerializable $this->iOutSecure = $iOutSecure; $this->bOutShortLogin = $bOutShortLogin; $this->bOutAuth = $bOutAuth; + $this->bOutSetSender = $bOutSetSender; $this->bOutUsePhpMail = $bOutUsePhpMail; $this->sWhiteList = \trim($sWhiteList); @@ -340,6 +351,11 @@ class Domain implements \JsonSerializable return $this->bOutAuth; } + public function OutSetSender() : bool + { + return $this->bOutSetSender; + } + public function OutUsePhpMail() : bool { return $this->bOutUsePhpMail; @@ -397,6 +413,7 @@ class Domain implements \JsonSerializable 'OutSecure' => $this->OutSecure(), 'OutShortLogin' => $this->OutShortLogin(), 'OutAuth' => $this->OutAuth(), + 'OutSetSender' => $this->OutSetSender(), 'OutUsePhpMail' => $this->OutUsePhpMail(), 'WhiteList' => $this->WhiteList(), 'AliasName' => $this->AliasName() @@ -421,6 +438,7 @@ class Domain implements \JsonSerializable 'OutSecure' => $this->OutSecure(), 'OutShortLogin' => $this->OutShortLogin(), 'OutAuth' => $this->OutAuth(), + 'OutSetSender' => $this->OutSetSender(), 'OutUsePhpMail' => $this->OutUsePhpMail(), 'WhiteList' => $this->WhiteList(), 'AliasName' => $this->AliasName() diff --git a/snappymail/v/0.0.0/app/libraries/RainLoop/Providers/Domain.php b/snappymail/v/0.0.0/app/libraries/RainLoop/Providers/Domain.php index 1d2d0a698..20b3040f7 100644 --- a/snappymail/v/0.0.0/app/libraries/RainLoop/Providers/Domain.php +++ b/snappymail/v/0.0.0/app/libraries/RainLoop/Providers/Domain.php @@ -96,31 +96,33 @@ class Domain extends AbstractProvider if ($this->bAdmin) { - $bCreate = '1' === (string) $oActions->GetActionParam('Create', '0'); $sName = (string) $oActions->GetActionParam('Name', ''); - $sIncHost = (string) $oActions->GetActionParam('IncHost', ''); - $iIncPort = (int) $oActions->GetActionParam('IncPort', 143); - $iIncSecure = (int) $oActions->GetActionParam('IncSecure', \MailSo\Net\Enumerations\ConnectionSecurityType::NONE); - $bIncShortLogin = '1' === (string) $oActions->GetActionParam('IncShortLogin', '0'); - $bUseSieve = '1' === (string) $oActions->GetActionParam('UseSieve', '0'); - $sSieveHost = (string) $oActions->GetActionParam('SieveHost', ''); - $iSievePort = (int) $oActions->GetActionParam('SievePort', 4190); - $iSieveSecure = (int) $oActions->GetActionParam('SieveSecure', \MailSo\Net\Enumerations\ConnectionSecurityType::NONE); - $sOutHost = (string) $oActions->GetActionParam('OutHost', ''); - $iOutPort = (int) $oActions->GetActionParam('OutPort', 25); - $iOutSecure = (int) $oActions->GetActionParam('OutSecure', \MailSo\Net\Enumerations\ConnectionSecurityType::NONE); - $bOutShortLogin = '1' === (string) $oActions->GetActionParam('OutShortLogin', '0'); - $bOutAuth = '1' === (string) $oActions->GetActionParam('OutAuth', '1'); - $bOutUsePhpMail = '1' === (string) $oActions->GetActionParam('OutUsePhpMail', '0'); - $sWhiteList = (string) $oActions->GetActionParam('WhiteList', ''); - if (0 < \strlen($sName) && 0 < strlen($sNameForTest) && false === \strpos($sName, '*')) + if (0 < \strlen($sName) && 0 < \strlen($sNameForTest) && !\str_contains($sName, '*')) { $sNameForTest = ''; } if (0 < strlen($sName) || 0 < strlen($sNameForTest)) { + $bCreate = '1' === (string) $oActions->GetActionParam('Create', '0'); + $sIncHost = (string) $oActions->GetActionParam('IncHost', ''); + $iIncPort = (int) $oActions->GetActionParam('IncPort', 143); + $iIncSecure = (int) $oActions->GetActionParam('IncSecure', \MailSo\Net\Enumerations\ConnectionSecurityType::NONE); + $bIncShortLogin = '1' === (string) $oActions->GetActionParam('IncShortLogin', '0'); + $bUseSieve = '1' === (string) $oActions->GetActionParam('UseSieve', '0'); + $sSieveHost = (string) $oActions->GetActionParam('SieveHost', ''); + $iSievePort = (int) $oActions->GetActionParam('SievePort', 4190); + $iSieveSecure = (int) $oActions->GetActionParam('SieveSecure', \MailSo\Net\Enumerations\ConnectionSecurityType::NONE); + $sOutHost = (string) $oActions->GetActionParam('OutHost', ''); + $iOutPort = (int) $oActions->GetActionParam('OutPort', 25); + $iOutSecure = (int) $oActions->GetActionParam('OutSecure', \MailSo\Net\Enumerations\ConnectionSecurityType::NONE); + $bOutShortLogin = '1' === (string) $oActions->GetActionParam('OutShortLogin', '0'); + $bOutAuth = '1' === (string) $oActions->GetActionParam('OutAuth', '1'); + $bOutSetSender = '1' === (string) $oActions->GetActionParam('OutSetSender', '0'); + $bOutUsePhpMail = '1' === (string) $oActions->GetActionParam('OutUsePhpMail', '0'); + $sWhiteList = (string) $oActions->GetActionParam('WhiteList', ''); + $oDomain = 0 < strlen($sNameForTest) ? null : $this->Load($sName); if ($oDomain instanceof \RainLoop\Model\Domain) { @@ -133,7 +135,7 @@ class Domain extends AbstractProvider $oDomain->UpdateInstance( $sIncHost, $iIncPort, $iIncSecure, $bIncShortLogin, $bUseSieve, $sSieveHost, $iSievePort, $iSieveSecure, - $sOutHost, $iOutPort, $iOutSecure, $bOutShortLogin, $bOutAuth, $bOutUsePhpMail, + $sOutHost, $iOutPort, $iOutSecure, $bOutShortLogin, $bOutAuth, $bOutSetSender, $bOutUsePhpMail, $sWhiteList); } } @@ -142,7 +144,7 @@ class Domain extends AbstractProvider $oDomain = new \RainLoop\Model\Domain(0 < strlen($sNameForTest) ? $sNameForTest : $sName, $sIncHost, $iIncPort, $iIncSecure, $bIncShortLogin, $bUseSieve, $sSieveHost, $iSievePort, $iSieveSecure, - $sOutHost, $iOutPort, $iOutSecure, $bOutShortLogin, $bOutAuth, $bOutUsePhpMail, + $sOutHost, $iOutPort, $iOutSecure, $bOutShortLogin, $bOutAuth, $bOutSetSender, $bOutUsePhpMail, $sWhiteList); } } @@ -172,6 +174,7 @@ class Domain extends AbstractProvider $iOutSecure = (int) $oActions->GetActionParam('OutSecure', \MailSo\Net\Enumerations\ConnectionSecurityType::NONE); $bOutShortLogin = '1' === (string) $oActions->GetActionParam('OutShortLogin', '0'); $bOutAuth = '1' === (string) $oActions->GetActionParam('OutAuth', '1'); + $bOutSetSender = '1' === (string) $oActions->GetActionParam('OutSetSender', '0'); $bOutUsePhpMail = '1' === (string) $oActions->GetActionParam('OutUsePhpMail', '0'); $sWhiteList = (string) $oActions->GetActionParam('WhiteList', ''); @@ -194,7 +197,7 @@ class Domain extends AbstractProvider $oDomain->UpdateInstance( $sIncHost, $iIncPort, $iIncSecure, $bIncShortLogin, $bUseSieve, $sSieveHost, $iSievePort, $iSieveSecure, - $sOutHost, $iOutPort, $iOutSecure, $bOutShortLogin, $bOutAuth, $bOutUsePhpMail, + $sOutHost, $iOutPort, $iOutSecure, $bOutShortLogin, $bOutAuth, $bOutSetSender, $bOutUsePhpMail, $sWhiteList); } } @@ -203,7 +206,7 @@ class Domain extends AbstractProvider $oDomain = new \RainLoop\Model\Domain(0 < strlen($sNameForTest) ? $sNameForTest : $sName, $sIncHost, $iIncPort, $iIncSecure, $bIncShortLogin, $bUseSieve, $sSieveHost, $iSievePort, $iSieveSecure, - $sOutHost, $iOutPort, $iOutSecure, $bOutShortLogin, $bOutAuth, $bOutUsePhpMail, + $sOutHost, $iOutPort, $iOutSecure, $bOutShortLogin, $bOutAuth, $bOutSetSender, $bOutUsePhpMail, $sWhiteList); } } diff --git a/snappymail/v/0.0.0/app/localization/admin/_source.en.yml b/snappymail/v/0.0.0/app/localization/admin/_source.en.yml index ca93094da..6808a181f 100644 --- a/snappymail/v/0.0.0/app/localization/admin/_source.en.yml +++ b/snappymail/v/0.0.0/app/localization/admin/_source.en.yml @@ -133,6 +133,7 @@ en: LABEL_ALLOW_SIEVE_SCRIPTS: "Allow sieve scripts" LABEL_USE_SHORT_LOGIN: "Use short login" LABEL_USE_AUTH: "Use authentication" + LABEL_SET_SENDER: "Use login as sender" LABEL_USE_PHP_MAIL: "Use php mail() function" BUTTON_TEST: "Test" BUTTON_WHITE_LIST: "White List" diff --git a/snappymail/v/0.0.0/app/localization/admin/de_DE.yml b/snappymail/v/0.0.0/app/localization/admin/de_DE.yml index 6329b82b7..d77595817 100644 --- a/snappymail/v/0.0.0/app/localization/admin/de_DE.yml +++ b/snappymail/v/0.0.0/app/localization/admin/de_DE.yml @@ -129,6 +129,7 @@ de_DE: LABEL_ALLOW_SIEVE_SCRIPTS: "Sieve-Skripte erlauben" LABEL_USE_SHORT_LOGIN: "Kurze Benutzernamen verwenden" LABEL_USE_AUTH: "Authentifizierung verwenden" + LABEL_SET_SENDER: "Verwenden Sie die Anmeldung als Absender" LABEL_USE_PHP_MAIL: "PHPs mail()-Funktion verwenden" BUTTON_TEST: "Testen" BUTTON_WHITE_LIST: "Whitelist" diff --git a/snappymail/v/0.0.0/app/localization/admin/en_US.yml b/snappymail/v/0.0.0/app/localization/admin/en_US.yml index fd5bf6eba..41e07becc 100644 --- a/snappymail/v/0.0.0/app/localization/admin/en_US.yml +++ b/snappymail/v/0.0.0/app/localization/admin/en_US.yml @@ -130,6 +130,7 @@ en_US: LABEL_ALLOW_SIEVE_SCRIPTS: "Allow sieve scripts" LABEL_USE_SHORT_LOGIN: "Use short login" LABEL_USE_AUTH: "Use authentication" + LABEL_SET_SENDER: "Use login as sender" LABEL_USE_PHP_MAIL: "Use php mail() function" BUTTON_TEST: "Test" BUTTON_WHITE_LIST: "White List" diff --git a/snappymail/v/0.0.0/app/localization/admin/es_ES.yml b/snappymail/v/0.0.0/app/localization/admin/es_ES.yml index e707e4f84..968fd529c 100644 --- a/snappymail/v/0.0.0/app/localization/admin/es_ES.yml +++ b/snappymail/v/0.0.0/app/localization/admin/es_ES.yml @@ -130,6 +130,7 @@ es_ES: LABEL_ALLOW_SIEVE_SCRIPTS: "Permitir scripts de filtro" LABEL_USE_SHORT_LOGIN: "Inicio de Sesión corto" LABEL_USE_AUTH: "Usar autenticación" + LABEL_SET_SENDER: "Usar inicio de sesión como remitente" LABEL_USE_PHP_MAIL: "Utilizar la función mail() de PHP" BUTTON_TEST: "Probar" BUTTON_WHITE_LIST: "Lista blanca" diff --git a/snappymail/v/0.0.0/app/localization/admin/fr_FR.yml b/snappymail/v/0.0.0/app/localization/admin/fr_FR.yml index 65beabf80..693bf9640 100644 --- a/snappymail/v/0.0.0/app/localization/admin/fr_FR.yml +++ b/snappymail/v/0.0.0/app/localization/admin/fr_FR.yml @@ -130,6 +130,7 @@ fr_FR: LABEL_ALLOW_SIEVE_SCRIPTS: "Autoriser les scripts sieve" LABEL_USE_SHORT_LOGIN: "Utiliser l'identifiant court" LABEL_USE_AUTH: "Utiliser l'authentification" + LABEL_SET_SENDER: "Utiliser la connexion en tant qu'expéditeur" LABEL_USE_PHP_MAIL: "Utiliser la fonction mail() de php" BUTTON_TEST: "Test" BUTTON_WHITE_LIST: "Liste Blanche" diff --git a/snappymail/v/0.0.0/app/localization/admin/nl_NL.yml b/snappymail/v/0.0.0/app/localization/admin/nl_NL.yml index 2afe933ed..712d0a043 100644 --- a/snappymail/v/0.0.0/app/localization/admin/nl_NL.yml +++ b/snappymail/v/0.0.0/app/localization/admin/nl_NL.yml @@ -129,6 +129,7 @@ nl_NL: LABEL_ALLOW_SIEVE_SCRIPTS: "Sta Sieve scripts toe" LABEL_USE_SHORT_LOGIN: "Gebruik verkorte login" LABEL_USE_AUTH: "Gebruik authenticatie" + LABEL_SET_SENDER: "Gebruik login als verzender" LABEL_USE_PHP_MAIL: "Gebruik php mail() functie" BUTTON_TEST: "Test" BUTTON_WHITE_LIST: "Witte lijst" diff --git a/snappymail/v/0.0.0/app/localization/admin/zh_CN.yml b/snappymail/v/0.0.0/app/localization/admin/zh_CN.yml index 4182a78e4..06e1a37d0 100644 --- a/snappymail/v/0.0.0/app/localization/admin/zh_CN.yml +++ b/snappymail/v/0.0.0/app/localization/admin/zh_CN.yml @@ -131,6 +131,7 @@ zh_CN: LABEL_ALLOW_SIEVE_SCRIPTS: "可使用筛选脚本" LABEL_USE_SHORT_LOGIN: "使用短用户名登录" LABEL_USE_AUTH: "使用认证" + LABEL_SET_SENDER: "使用登录名作为发件人" LABEL_USE_PHP_MAIL: "使用 php mail() 函数" BUTTON_TEST: "测试" BUTTON_WHITE_LIST: "白名单" diff --git a/snappymail/v/0.0.0/app/templates/Views/Admin/PopupsDomain.html b/snappymail/v/0.0.0/app/templates/Views/Admin/PopupsDomain.html index 427fe23da..22d6e46f3 100644 --- a/snappymail/v/0.0.0/app/templates/Views/Admin/PopupsDomain.html +++ b/snappymail/v/0.0.0/app/templates/Views/Admin/PopupsDomain.html @@ -49,7 +49,6 @@ data-bind="textInput: imapPort" /> -
@@ -115,7 +114,6 @@ data-bind="textInput: sievePort" />
-
@@ -161,7 +159,6 @@ data-bind="textInput: smtpPort" />
-
@@ -186,7 +183,10 @@ }">
   (user@domain.com → user) -
+
+ +
+
+
+
+
+