Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 6556f49

Browse filesBrowse files
committed
minor #8487 [Validator] Html5 Email Validation (PurpleBooth)
This PR was merged into the master branch. Discussion ---------- [Validator] Html5 Email Validation Add documentation about the new mode parameter. Adds descriptions for the 'loose', 'strict', and 'html5' options. Relates to symfony/symfony#24442 Commits ------- 07d4bf9 [Validator] Html5 Email Validation
2 parents 16055f7 + 07d4bf9 commit 6556f49
Copy full SHA for 6556f49

File tree

2 files changed

+29
-8
lines changed
Filter options

2 files changed

+29
-8
lines changed

‎email/testing.rst

Copy file name to clipboardExpand all lines: email/testing.rst
+2-2Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,8 +73,8 @@ Problem: The Collector Object Is ``null``
7373
The email collector is only available when the profiler is enabled and collects
7474
information, as explained in :doc:`/testing/profiling`.
7575

76-
Problem: The Collector Doesn't Contain the E-Mail
77-
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
76+
Problem: The Collector Doesn't Contain the Email
77+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
7878

7979
If a redirection is performed after sending the email (for example when you send
8080
an email after a form is processed and before redirecting to another page), make

‎reference/constraints/Email.rst

Copy file name to clipboardExpand all lines: reference/constraints/Email.rst
+27-6Lines changed: 27 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ cast to a string before being validated.
77
+----------------+---------------------------------------------------------------------+
88
| Applies to | :ref:`property or method <validation-property-target>` |
99
+----------------+---------------------------------------------------------------------+
10-
| Options | - `strict`_ |
10+
| Options | - `mode`_ |
1111
| | - `message`_ |
1212
| | - `checkMX`_ |
1313
| | - `checkHost`_ |
@@ -91,14 +91,34 @@ Basic Usage
9191
Options
9292
-------
9393

94+
mode
95+
~~~~
96+
97+
**type**: ``string`` **default**: ``loose``
98+
99+
This option is optional and defines the pattern the email address is validated against.
100+
Valid values are:
101+
102+
* ``loose``
103+
* ``strict``
104+
* ``html5``
105+
106+
loose
107+
.....
108+
109+
A simple regular expression. Allows all values with an "@" symbol in, and a "."
110+
in the second host part of the email address.
111+
94112
strict
95-
~~~~~~
113+
......
96114

97-
**type**: ``boolean`` **default**: ``false``
115+
Uses the `egulias/email-validator`_ library to perform an RFC compliant
116+
validation. You will need to install that library to use this mode.
117+
118+
html5
119+
.....
98120

99-
When false, the email will be validated against a simple regular expression.
100-
If true, then the `egulias/email-validator`_ library is required to perform
101-
an RFC compliant validation.
121+
This matches the pattern used for the `HTML5 email input element`_.
102122

103123
message
104124
~~~~~~~
@@ -127,3 +147,4 @@ of the given email.
127147
.. include:: /reference/constraints/_payload-option.rst.inc
128148

129149
.. _egulias/email-validator: https://packagist.org/packages/egulias/email-validator
150+
.. _HTML5 email input element: https://www.w3.org/TR/html5/sec-forms.html#email-state-typeemail

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.