Validate email address on user input

We found several users that have problem with notification emails due to wrong input of the party emails. As we have a validation for phone numbers I’m wonder if we should not have some for email also.

If found there is an email-validation library on PyPi that may do the job for us. I see it checks also the correctnes of DNS records and that is something that we may want to disable on systems without network access.

Like with phone numbers this library will be optional (but enabled by default on our docker image) so anyone that does not want to have the email validation can just skip the instalation of the library.

Toughts?

1 Like

email validation is difficult but this library does not look bad.
For the DNS validation I think in case of timeout we should allow the user to skip it via a warning.
Also test_environment should be set when running tests.

It’s a bit a pity that it’s a parameter to the actual validation call:

(and setting the module level variable won’t work since the default value is set before setting it of course :smiley:).

This can be done using Pool.test value.

The formatting should also be applied to web.user because for now we are just lowering the full address (cf. _format_email).