Automattic\WooCommerce\Internal\Email

EmailLogger::redact_emails │ private │ WC 1.0

Replace any email addresses in a log message fragment with [redacted_email].

PHPMailer / SMTP error strings frequently embed the recipient address (e.g. "SMTP Error: Could not send to foo@example.com"). Without redaction, the address would be written into the log message and — when the database log handler is active — surface in WC > Status > Logs to anyone with manage_woocommerce, defeating the username/guest resolution applied to the recipient context field.

Mirrors the regex used by RemoteLogger::redact_user_data() so the privacy posture stays consistent across loggers.

Метод класса: EmailLogger{}

Хуков нет.

Возвращает

string. The fragment with any email addresses replaced.

Использование

// private - только в коде основоного (родительского) класса
$result = $this->redact_emails( $message ): string;
$message(строка) (обязательный)
The message fragment to scrub.

Код EmailLogger::redact_emails() WC 11.2.2

private function redact_emails( string $message ): string {
	return (string) preg_replace( '/[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}/', '[redacted_email]', $message );
}