Skip to content

Commit 799c57b

Browse files
committed
Documented the email_validation_mode config option
1 parent 8e21247 commit 799c57b

File tree

1 file changed

+26
-0
lines changed

1 file changed

+26
-0
lines changed

reference/configuration/framework.rst

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,7 @@ Configuration
9999
* :ref:`enable_annotations <reference-validation-enable_annotations>`
100100
* `translation_domain`_
101101
* `strict_email`_
102+
* `email_validation_mode`_
102103
* :ref:`mapping <reference-validation-mapping>`
103104
* :ref:`paths <reference-validation-mapping-paths>`
104105
* `annotations`_
@@ -1577,10 +1578,34 @@ strict_email
15771578

15781579
**type**: ``Boolean`` **default**: ``false``
15791580

1581+
.. versionadded:: 4.1
1582+
The ``strict_email`` option was deprecated in Symfony 4.1. Use the new
1583+
``email_validation_mode`` option instead.
1584+
15801585
If this option is enabled, the `egulias/email-validator`_ library will be
15811586
used by the :doc:`/reference/constraints/Email` constraint validator. Otherwise,
15821587
the validator uses a simple regular expression to validate email addresses.
15831588

1589+
email_validation_mode
1590+
.....................
1591+
1592+
**type**: ``string`` **default**: ``loose``
1593+
1594+
.. versionadded:: 4.1
1595+
The ``email_validation_mode`` option was introduced in Symfony 4.1.
1596+
1597+
It controls the way email addresses are validated by the
1598+
:doc:`/reference/constraints/Email` validator. The possible values are:
1599+
1600+
* ``loose``, it uses a simple regular expression to validate the address (it
1601+
checks that at least one ``@`` character is present, etc.). This validation is
1602+
too simple and it's recommended to use the ``html5`` validation instead;
1603+
* ``html5``, it validates email addresses using the same regular expression
1604+
defined in the HTML5 standard, making the backend validation consistent with
1605+
the one provided by browsers;
1606+
* ``strict``, it uses the `egulias/email-validator`_ library (which you must
1607+
install separately) to validate the addresses according to the `RFC 5322`_.
1608+
15841609
.. _reference-validation-mapping:
15851610

15861611
mapping
@@ -2056,6 +2081,7 @@ Full Default Configuration
20562081
.. _`Security Advisory Blog post`: https://symfony.com/blog/security-releases-symfony-2-0-24-2-1-12-2-2-5-and-2-3-3-released#cve-2013-4752-request-gethost-poisoning
20572082
.. _`Doctrine Cache`: http://docs.doctrine-project.org/projects/doctrine-common/en/latest/reference/caching.html
20582083
.. _`egulias/email-validator`: https://github.com/egulias/EmailValidator
2084+
.. _`RFC 5322`: https://tools.ietf.org/html/rfc5322
20592085
.. _`PhpStormProtocol`: https://github.com/aik099/PhpStormProtocol
20602086
.. _`phpstorm-url-handler`: https://github.com/sanduhrs/phpstorm-url-handler
20612087
.. _`blue/green deployment`: http://martinfowler.com/bliki/BlueGreenDeployment.html

0 commit comments

Comments
 (0)