Rocksolid Light

Welcome to RetroBBS

mail  files  register  newsreader  groups  login

Message-ID:  

Don't panic.


devel / comp.lang.python / RE: Checking if email is valid

SubjectAuthor
o RE: Checking if email is valid<avi.e.gross

1
RE: Checking if email is valid

<mailman.141.1698974385.3828.python-list@python.org>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=28740&group=comp.lang.python#28740

  copy link   Newsgroups: comp.lang.python
Path: i2pn2.org!i2pn.org!news.swapon.de!fu-berlin.de!uni-berlin.de!not-for-mail
From: <avi.e.gross@gmail.com>
Newsgroups: comp.lang.python
Subject: RE: Checking if email is valid
Date: Thu, 2 Nov 2023 21:19:41 -0400
Lines: 63
Message-ID: <mailman.141.1698974385.3828.python-list@python.org>
References: <2d05ed9e-0c4f-152a-e072-f64d21da3b13@gmail.com>
<4SLzJm1dwdznWHQ@mail.python.org>
<01b401da0df3$d2a4f150$77eed3f0$@gmail.com>
Mime-Version: 1.0
Content-Type: text/plain;
charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
X-Trace: news.uni-berlin.de ifPwjJdlo7uui4bISIR3CARoegeBl7foYEmi8ek69s4w==
Cancel-Lock: sha1:a75YjVN0kCmi/remF3DHbDT5VK4= sha256:JLIUaaJ/H14YbgW4u33cocdo6++ptKd5nP0B8Ib160Y=
Return-Path: <avi.e.gross@gmail.com>
X-Original-To: python-list@python.org
Delivered-To: python-list@mail.python.org
Authentication-Results: mail.python.org; dkim=pass
reason="2048-bit key; unprotected key"
header.d=gmail.com header.i=@gmail.com header.b=aondHnj6;
dkim-adsp=pass; dkim-atps=neutral
X-Spam-Status: OK 0.007
X-Spam-Evidence: '*H*': 0.99; '*S*': 0.00; '2023': 0.07; 'django':
0.07; 'modules': 0.07; 'string': 0.07; 'tests': 0.07; 'wrong.':
0.07; 'cases.': 0.09; 'child': 0.09; 'incorporated': 0.09;
'messages.': 0.09; 'obviously': 0.09; 'originally': 0.09;
'received:108': 0.09; 'text.': 0.09; 'thinks': 0.09;
'url:mailman': 0.15; '--------': 0.16; 'addresses.': 0.16;
'algorithms': 0.16; 'conforms': 0.16; 'declare': 0.16; 'humans':
0.16; 'junk': 0.16; 'object,': 0.16; 'parsing': 0.16; 'simon':
0.16; 'probably': 0.17; 'message-id:@gmail.com': 0.18;
'addresses': 0.19; 'url': 0.19; 'to:addr:python-list': 0.20;
'basically': 0.22; 'code': 0.23; 'run': 0.23; 'past': 0.25;
'skip:- 10': 0.25; 'url-ip:188.166.95.178/32': 0.25; 'url-
ip:188.166.95/24': 0.25; 'url:listinfo': 0.25; 'url-
ip:188.166/16': 0.25; 'seems': 0.26; 'object': 0.26; 'bit': 0.27;
'example,': 0.28; 'asked': 0.29; 'approach': 0.31; 'looked': 0.31;
'module': 0.31; 'url-ip:188/8': 0.31; 'everyone': 0.32; 'guess':
0.32; 'python-list': 0.32; 'right,': 0.32; 'but': 0.32; "i'm":
0.33; 'there': 0.33; 'able': 0.34; 'header:In-Reply-To:1': 0.34;
'received:google.com': 0.34; 'invalid': 0.35;
'from:addr:gmail.com': 0.35; 'people': 0.36; 'source': 0.36;
'change': 0.36; 'special': 0.37; 'class': 0.37; 'could': 0.38;
'read': 0.38; 'quite': 0.39; 'date:': 0.39; 'valid': 0.39; 'use':
0.39; 'shared': 0.39; 'difficult': 0.40; 'statistical': 0.40;
'want': 0.40; 'michael': 0.60; 'from:': 0.62; 'to:': 0.62;
'format': 0.62; 'email': 0.63; 'everything': 0.63; 're:': 0.64;
'your': 0.64; 'parts': 0.65; 'spam': 0.65; 'look': 0.65; 'back':
0.67; 'end,': 0.69; 'virtually': 0.69; 'times': 0.69; 'truly':
0.70; 'interesting': 0.71; 'relevant': 0.73; 'sent:': 0.78;
'unit': 0.81; 'decent': 0.84; 'invalid.': 0.84; 'method,': 0.84;
'nation,': 0.84; 'survives': 0.84; 'badly': 0.91; 'aspects': 0.93;
'turned': 0.95
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=gmail.com; s=20230601; t=1698974383; x=1699579183; darn=python.org;
h=content-language:thread-index:content-transfer-encoding
:mime-version:message-id:date:subject:in-reply-to:references:to:from
:from:to:cc:subject:date:message-id:reply-to;
bh=f01jUNv3jpw37OwTtv2KaSJ/5e4yw/vUhW78b+sypY4=;
b=aondHnj6itW13nPHkfSWOB3gxWrCLsUpM9szvH+MVPHW4+W8/6aQUDr8Oxay7DX7tT
Gaz8FDPVQZtquWsVrOlgUtAbh20nwndgSDHPs+R8X1nAR4XViJC0WYJN5o5S80O6Thx+
UrjTZPhRYmfh0jqnv28sJtcB45jAaiBK2f2nWiw0sQySbFsRRIMXlgw93PItuxLer6nh
npAzb0vv49MeABASC/eA3ANY2rh/MPo6nQF4d6QdurMVylWRsm4IcfdysY5DI5XnhV8p
ka0ZyNwk07A+6hHkNQjt4nlv3aQBTAO+ikTEg37iM8xR+7lA/3QxwGftOX5jysR+gnO/
dXJw==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=1e100.net; s=20230601; t=1698974383; x=1699579183;
h=content-language:thread-index:content-transfer-encoding
:mime-version:message-id:date:subject:in-reply-to:references:to:from
:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to;
bh=f01jUNv3jpw37OwTtv2KaSJ/5e4yw/vUhW78b+sypY4=;
b=FoISN2w8FNEaMwR4odPk76fWpggalaSwu+JMgbGgvkdd6J+99jAWzsYf3/r+wVpCmB
5GcYkmaaTdffGQGa7t0W0GVdwtEgsc3BL65JNrdJpzfjr0CJmF+xNgNNXbXI/c74Y+4v
m8pAZEYq1h7eHLZLdQmvE9EaPupRWawH0d/qP9GJJrh69Z3xXA+O2LX21WrW9q4mka7u
0T5LNWW9xG3AHTPM/FhAFxzHvGAu9xMZkGtX0lPAJuXoT5wCRWL66k5SmKW1F8CmFC/8
0ONo7WLzX8HnB7W5+J4YI1pUf0besbwY8cApxpWiLz5Dyrqjagcd8I8Coys7hH1dkv0g
3Oiw==
X-Gm-Message-State: AOJu0YzjiaVELPopjSHs2Fs6gsk0s6VuxH0FAx8inv7zmH5LiCt1jInn
13peSi4uLec+bCSpRf7xNSmsUy0Rthk=
X-Google-Smtp-Source: AGHT+IFCtes42o3Z1S0qxIxk604CYuHy+dOFsz9TovH6t6o7zdSdGE5NGvcqhspjlBP9utVW5gyYrw==
X-Received: by 2002:a67:c28e:0:b0:458:47e6:70e4 with SMTP id
k14-20020a67c28e000000b0045847e670e4mr20541726vsj.19.1698974383236;
Thu, 02 Nov 2023 18:19:43 -0700 (PDT)
In-Reply-To: <4SLzJm1dwdznWHQ@mail.python.org>
X-Mailer: Microsoft Outlook 16.0
Thread-Index: AQM9PRk51tnYe5dL97kqfbrJSSzvpK2halSw
Content-Language: en-us
X-BeenThere: python-list@python.org
X-Mailman-Version: 2.1.39
Precedence: list
List-Id: General discussion list for the Python programming language
<python-list.python.org>
List-Unsubscribe: <https://mail.python.org/mailman/options/python-list>,
<mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive: <https://mail.python.org/pipermail/python-list/>
List-Post: <mailto:python-list@python.org>
List-Help: <mailto:python-list-request@python.org?subject=help>
List-Subscribe: <https://mail.python.org/mailman/listinfo/python-list>,
<mailto:python-list-request@python.org?subject=subscribe>
X-Mailman-Original-Message-ID: <01b401da0df3$d2a4f150$77eed3f0$@gmail.com>
X-Mailman-Original-References: <2d05ed9e-0c4f-152a-e072-f64d21da3b13@gmail.com>
<4SLzJm1dwdznWHQ@mail.python.org>
 by: <avi.e.gross@gmail.com> - Fri, 3 Nov 2023 01:19 UTC

I have never had a need to check email but in my reading over the years, I am aware of modules of multiple kinds you can use to do things like parsing dates, URL and email addresses and probably many other such things into some kind of object and then you can use aspects of the object to do interesting things and perhaps change some and then ask for the object to be placed back into some other format such as text.

My guess is that a first test of an email address might be to see if a decent module of that kind fills out the object to your satisfaction. You can then perhaps test parts of the object, rather than everything at once, to see if it is obviously invalid. As an example, what does user@alpha.......com with what seems to be lots of meaningless periods, get parsed into?

This may be another approach that reuses what may be well-designed and tested shared software. I wonder if there are also such modules that do quite a bit of what is asked which is to reject a large class of badly formed addresses. You could, of course, take what survives and run additional screens.

In the end, this is a bit like junkmail where some light-AI algorithms go over a corpus of messages that humans have curated as junk or not junk and make some statistical decisions that are nonetheless often wrong. In that case, many humans nastily declare thinks as SPAM just because they do not want to get such messages. If you blasted out email alerts every time a child seems to have been kidnapped to everyone in the nation, how long before many such messages would become designated as SPAM?

So is there any work where people have taken a decent collection of email addresses used in the past that turned out to be syntactically valid or not, and trained an algorithm to recognize most of them properly? That trained algorithm could be shared and incorporated into your programs either as the only method, or one you use in special cases.

-----Original Message-----
From: Python-list <python-list-bounces+avi.e.gross=gmail.com@python.org> On Behalf Of Mike Dewhirst via Python-list
Sent: Thursday, November 2, 2023 6:31 PM
To: python-list@python.org
Subject: Re: Checking if email is valid

If i wanted an email verifier I would look at open source frameworks and see how they do it. Django comes to mind.--(Unsigned mail from my phone)
-------- Original message --------From: Michael Torrie via Python-list <python-list@python.org> Date: 3/11/23 07:23 (GMT+10:00) To: python-list@python.org Subject: Re: Checking if email is valid On 11/2/23 00:42, Simon Connah via Python-list wrote:> Basically I'm writing unit tests and one of them passess in a string > with an invalid email address. I need to be able to check the string > to see if it is a valid email so that the unit test passess.If you truly have managed to code an RFC-compliant verifier, I commend you.> Valid as in conforms to the standard. Although having looked at the> standard that might be more difficult than originally planned.You'll have to read the relevant RFCs. Lots of corner cases! From whatI can see virtually no one on the internet gets it right, judging by thenumber of times I have valid email addresses flagged as not valid bypoor algorithms.-- https://mail.python.org/mailman/listinfo/python-list
--
https://mail.python.org/mailman/listinfo/python-list


devel / comp.lang.python / RE: Checking if email is valid

1
server_pubkey.txt

rocksolid light 0.9.81
clearnet tor