On Mon, 29 Nov 2021 at 06:18, Dhruva Gole <[email protected]> wrote:
> I am currently writing a patch to address the bug, in which I have so far 
> done the maintainer and patch strings check in READMe.
> However I had doubts on how the community would like me to implement the 
> email address checker.
> One way is:
> I referred to this: 
> https://stackoverflow.com/questions/8022530/how-to-check-for-valid-email-address/28982264#28982264
>  and found the following code could be useful:
>
> from validate_email import validate_email
> is_valid = validate_email(email_address='[email protected]', \
>     check_regex=True, check_mx=True, \
>     from_address='[email protected]', helo_host='my.host.name', \
>     smtp_timeout=10, dns_timeout=10, use_blacklist=True)
>
> Other way: (simple check)
> is to just use the python re library as given here: 
> https://www.geeksforgeeks.org/check-if-email-address-valid-or-not-in-python/
>
> Please let me know which approach would be preferred.

A simple RE would be best.  Don't try to validate every address with
SMTP, and don't try to be too clever with the RE: false positives are
better than false negatives.

Pretty sure the RE linked there is too strict and assumes that
top-level domains can't have email, which isn't the case.  Fun
internet fact: the .tt top-level domain (for Trinidad and Tobago)
accepts mails (it has MX records), so t@tt could be a valid email
address.

Ross
-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#158937): 
https://lists.openembedded.org/g/openembedded-core/message/158937
Mute This Topic: https://lists.openembedded.org/mt/87372769/21656
Group Owner: [email protected]
Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub 
[[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-

Reply via email to