ASPP / massmail

Script to send mass mail
2 stars 56 forks source link

Create a function to check the validity of an email address given as a parameter. #13

Open eroesch opened 7 years ago

eroesch commented 7 years ago

In a dedicated function, use re.match() to check the validity of a given email address. The function can then be called to test the validity of the FROM parameter, as well as for every addresses extracted from the parameter file. It should use a variant of the following regex (from: https://www.scottbrady91.com/Email-Verification/Python-Email-Verification-Script):

import re

addressToVerify ='info@emailhippo.com'
match = re.match('^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,4})$', addressToVerify)

if match == None:
    print('Bad Syntax')
    raise ValueError('Bad Syntax')
esigalas commented 7 years ago

We are working on it. -Claire -Evangelos, -Markus