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 ------- On Wednesday, 1 November 2023 at 10:09, Simon Connah <simon.n.con...@protonmail.com> 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 > required paying for third party services. > > Could someone push me in the right direction please? I just want to find out > if a string is a valid email address. > > Thank you. > > Simon.
signature.asc
Description: OpenPGP digital signature
-- https://mail.python.org/mailman/listinfo/python-list