mirror of
https://github.com/the-djmaze/snappymail.git
synced 2026-07-13 03:27:39 +03:00
v2.3.1
This commit is contained in:
parent
e26f00e268
commit
eeb289ea44
10 changed files with 28 additions and 23 deletions
|
|
@ -29,7 +29,9 @@ class DemoAccountPlugin extends \RainLoop\Plugins\AbstractPlugin
|
|||
\RainLoop\Plugins\Property::NewInstance('email')->SetLabel('Demo Email')
|
||||
->SetDefaultValue('demo@domain.com'),
|
||||
\RainLoop\Plugins\Property::NewInstance('password')->SetLabel('Demo Password')
|
||||
->SetType(\RainLoop\Enumerations\PluginPropertyType::PASSWORD)
|
||||
->SetType(\RainLoop\Enumerations\PluginPropertyType::PASSWORD),
|
||||
\RainLoop\Plugins\Property::NewInstance('recipient_delimiter')->SetLabel('recipient_delimiter')
|
||||
->SetDefaultValue(''),
|
||||
);
|
||||
}
|
||||
|
||||
|
|
@ -78,19 +80,23 @@ class DemoAccountPlugin extends \RainLoop\Plugins\AbstractPlugin
|
|||
public function FilterSendMessage($oMessage)
|
||||
{
|
||||
if ($oMessage && $this->isDemoAccount()) {
|
||||
$sEmail = $this->Config()->Get('plugin', 'email');
|
||||
$recipient_delimiter = $this->Config()->Get('plugin', 'recipient_delimiter');
|
||||
$regex = '/^' . \preg_quote($this->Config()->Get('plugin', 'email')) . '$/D';
|
||||
if ($recipient_delimiter) {
|
||||
$regex = \str_replace('@', '('.\preg_quote($recipient_delimiter).'.+)?@', $regex);
|
||||
}
|
||||
foreach ($oMessage->GetTo() as $oEmail) {
|
||||
if ($oEmail->GetEmail() !== $sEmail) {
|
||||
if (!\preg_match($regex, $oEmail->GetEmail())) {
|
||||
throw new \RainLoop\Exceptions\ClientException(\RainLoop\Notifications::DemoSendMessageError);
|
||||
}
|
||||
}
|
||||
foreach ($oMessage->GetCc() ?: [] as $oEmail) {
|
||||
if ($oEmail->GetEmail() !== $sEmail) {
|
||||
if (!\preg_match($regex, $oEmail->GetEmail())) {
|
||||
throw new \RainLoop\Exceptions\ClientException(\RainLoop\Notifications::DemoSendMessageError);
|
||||
}
|
||||
}
|
||||
foreach ($oMessage->GetBcc() ?: [] as $oEmail) {
|
||||
if ($oEmail->GetEmail() !== $sEmail) {
|
||||
if (!\preg_match($regex, $oEmail->GetEmail())) {
|
||||
throw new \RainLoop\Exceptions\ClientException(\RainLoop\Notifications::DemoSendMessageError);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue