RE: Checking if email is valid

2023-11-01 Thread AVI GROSS via Python-list
Yes, it would be nice if there was a syntax for sending a test message sort of like an ACK that is not delivered to the recipient but merely results in some status being sent back such as DELIVERABLE or NO SUCH USER or even MAILBOX FULL. An issue with the discussion that may be worth considering

Re: Checking if email is valid

2023-11-01 Thread Ian Hobson via Python-list
See https://www.linuxjournal.com/article/9585?page=0,0 On 01/11/2023 17:09, Simon Connah via Python-list wrote: Hi, I'm building a simple project using smtplib and have a question. I've been doing unit testing but I'm not sure how to check if an email message is valid. Using regex sounds

Re: Checking if email is valid

2023-11-01 Thread D'Arcy Cain via Python-list
On 2023-11-01 17:17, Chris Angelico via Python-list wrote: On Thu, 2 Nov 2023 at 08:09, Grant Edwards via Python-list wrote: Make sure it has an '@' in it. Possibly require at least one '.' after the '@'. No guarantee that there'll be a dot after the at. (Technically there's no guarantee of

Re: Checking if email is valid

2023-11-01 Thread Cameron Simpson via Python-list
On 01Nov2023 14:08, Grant Edwards wrote: On 2023-11-01, Simon Connah via Python-list wrote: I'm building a simple project using smtplib and have a question. I've been doing unit testing but I'm not sure how to check if an email message is valid. [...] Could someone push me in the right

Re: Checking if email is valid

2023-11-01 Thread Michael Torrie via Python-list
On 11/1/23 04:09, Simon Connah via Python-list wrote: > Hi, > > I'm building a simple project using smtplib and have a question. I've been > doing unit testing but I'm not sure how to check if an email message is > valid. Using regex sounds like a bad idea to me and the other options I found >

Re: Checking if email is valid

2023-11-01 Thread Chris Angelico via Python-list
On Thu, 2 Nov 2023 at 08:52, Grant Edwards via Python-list wrote: > > On 2023-11-01, Chris Angelico via Python-list wrote: > > On Thu, 2 Nov 2023 at 08:09, Grant Edwards via Python-list > > wrote: > > >> Make sure it has an '@' in it. Possibly require at least one '.' > >> after the '@'. > > >

Re: Checking if email is valid

2023-11-01 Thread Grant Edwards via Python-list
On 2023-11-01, Chris Angelico via Python-list wrote: > On Thu, 2 Nov 2023 at 08:09, Grant Edwards via Python-list > wrote: >> Make sure it has an '@' in it. Possibly require at least one '.' >> after the '@'. > > No guarantee that there'll be a dot after the at. Ah, I forgot about defaulting

Re: Checking if email is valid

2023-11-01 Thread Chris Angelico via Python-list
On Thu, 2 Nov 2023 at 08:09, Grant Edwards via Python-list wrote: > Make sure it has an '@' in it. Possibly require at least one '.' > after the '@'. No guarantee that there'll be a dot after the at. (Technically there's no guarantee of an at sign either, but email addresses without at signs

Re: Checking if email is valid

2023-11-01 Thread Grant Edwards via Python-list
On 2023-11-01, Simon Connah via Python-list wrote: > I'm building a simple project using smtplib and have a > question. I've been doing unit testing but I'm not sure how to check > if an email message is valid. Send an e-mail using it? If the right person gets the e-mail, then it's valid? >

Re: Checking if email is valid

2023-11-01 Thread De ongekruisigde via Python-list
On 2023-11-01, Mats Wichmann wrote: > On 11/1/23 05:35, Simon Connah via Python-list wrote: >> OK. I've been doing some reading and that you should avoid regex to check >> email addresses. So what I was thinking was something like this: > > To be a little more specific, Avoid Rolling Your Own

Re: Checking if email is valid

2023-11-01 Thread dn via Python-list
On 02/11/2023 00.35, Simon Connah via Python-list wrote: OK. I've been doing some reading and that you should avoid regex to check email addresses. This operation used to be a BIG THING back in the days of 'everyone' building PHP web-sites. When there were only a handful of TLDs (top-level

Re: Checking if email is valid

2023-11-01 Thread Mats Wichmann via Python-list
On 11/1/23 05:35, Simon Connah via Python-list wrote: OK. I've been doing some reading and that you should avoid regex to check email addresses. So what I was thinking was something like this: To be a little more specific, Avoid Rolling Your Own RegEx. It's very tricky, and you will get it

Re: Checking if email is valid

2023-11-01 Thread Chris Angelico via Python-list
On Thu, 2 Nov 2023 at 06:02, Jon Ribbens via Python-list wrote: > > On 2023-11-01, Chris Angelico wrote: > > On Thu, 2 Nov 2023 at 05:21, Simon Connah via Python-list > > wrote: > >> Could someone push me in the right direction please? I just want to > >> find out if a string is a valid email

Re: Checking if email is valid

2023-11-01 Thread Jon Ribbens via Python-list
On 2023-11-01, Chris Angelico wrote: > On Thu, 2 Nov 2023 at 05:21, Simon Connah via Python-list > wrote: >> Could someone push me in the right direction please? I just want to >> find out if a string is a valid email address. > > There is only one way to know that a string is a valid email

Re: Checking if email is valid

2023-11-01 Thread Chris Angelico via Python-list
On Thu, 2 Nov 2023 at 05:21, Simon Connah via Python-list wrote: > > Could someone push me in the right direction please? I just want to find out > if a string is a valid email address. There is only one way to know that a string is a valid email address, and that's to send an email to it.

Checking if email is valid

2023-11-01 Thread Simon Connah via Python-list
Hi, I'm building a simple project using smtplib and have a question. I've been doing unit testing but I'm not sure how to check if an email message is valid. Using regex sounds like a bad idea to me and the other options I found required paying for third party services. Could someone push me

Re: Checking if email is valid

2023-11-01 Thread Simon Connah via Python-list
OK. I've been doing some reading and that you should avoid regex to check email addresses. So what I was thinking was something like this: if type(email_recipient) != email.message.Message: I just don't know why that particular line isn't working. Thank you! --- Original Message ---