diff --git a/app/Services/TelegramBotService.php b/app/Services/TelegramBotService.php index 9b104db..d62af41 100644 --- a/app/Services/TelegramBotService.php +++ b/app/Services/TelegramBotService.php @@ -1186,8 +1186,9 @@ class TelegramBotService private function maskEmail(string $email): string { [$local, $domain] = explode('@', $email, 2); - $visible = mb_substr($local, 0, min(3, mb_strlen($local))); - return $visible . str_repeat('*', max(0, mb_strlen($local) - 3)) . '@' . $domain; + $len = mb_strlen($local); + $visible = max(4, (int) ceil($len / 2)); // muestra la mitad, mínimo 4 caracteres + return mb_substr($local, 0, min($visible, $len)) . str_repeat('*', max(0, $len - $visible)) . '@' . $domain; } private function createMPPreference(string $titulo, int $valor, string $ref): ?string