Skip to content
This repository has been archived by the owner on Nov 17, 2021. It is now read-only.

Commit

Permalink
minor #1335 [Doc] Fixed a minor issue in a code example (javiereguiluz)
Browse files Browse the repository at this point in the history
This PR was merged into the 6.2-dev branch.

Discussion
----------

[Doc] Fixed a minor issue in a code example

| Q             | A
| ------------- | ---
| Bug fix?      | no
| New feature?  | no
| Doc update?   | yes
| BC breaks?    | no
| Deprecations? | no
| Fixed tickets | -
| License       | MIT

Commits
-------

0aaa0c6 [Doc] Fixed a minor issue in a code example
  • Loading branch information
fabpot committed Apr 6, 2021
2 parents 27d5ef8 + 0aaa0c6 commit 6044649
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions doc/messages.rst
Original file line number Diff line number Diff line change
Expand Up @@ -479,11 +479,13 @@ Mailer will throw a ``Swift_RfcComplianceException``.
If you add recipients automatically based on a data source that may contain
invalid email addresses, you can prevent possible exceptions by validating the
addresses using::
use Egulias\EmailValidator\EmailValidator;
use Egulias\EmailValidator\Validation\RFCValidation;

$validator = new EmailValidator();
$validator->isValid("example@example.com", new RFCValidation()); //true
use Egulias\EmailValidator\EmailValidator;
use Egulias\EmailValidator\Validation\RFCValidation;

$validator = new EmailValidator();
$validator->isValid("example@example.com", new RFCValidation()); //true

and only adding addresses that validate. Another way would be to wrap your ``setTo()``, ``setCc()`` and
``setBcc()`` calls in a try-catch block and handle the
``Swift_RfcComplianceException`` in the catch block.
Expand Down

0 comments on commit 6044649

Please sign in to comment.