Codex

Function Reference/sanitize email

Contents

Description

Strips out all characters that are not allowable in an email.

Usage

<?php sanitize_email$email ?>

Parameters

$email
(string) (required) Email address to filter.
Default: None

Return Values

(string) 
Filtered email address.

Examples

Notes

  • This function uses a smaller allowable character set than the set defined by RFC 5322. Some legal email addresses may be changed.
  • Allowed character regular expression: /[^a-z0-9+_.@-]/i.

Change Log

Since: 1.5.0

Source File

sanitize_email() is located in wp-includes/formatting.php#L1860.

Related Functions

sanitize_email() is in a class of functions that help you sanitize potentially unsafe data which allow you to pass an arbitrary variable and receive the clean version based on data type. Others include:

Related

See also index of Function Reference and index of Template Tags.