Menu

#1228 sync_members just failes if even 1 email address is invalid

2.1 (stable)
open
nobody
5
2008-01-13
2008-01-13
Tony Mobily
No

Hi,

Right now, sync_members just fails if there are invalid email addresses.
I wrote a Drupal module that uses mailman to send emails. The problem I have is that I am using sync_members automatically, and it would be 100 times easier for me if the invalid email addresses were ignored, rather than the whole script failing.
The code is:

# first filter out any invalid addresses
filemembers = email.Utils.getaddresses(filemembers)
invalid = 0
for name, addr in filemembers:
try:
Utils.ValidateEmail(addr)
except Errors.EmailAddressError:
print _('Invalid : %(addr)30s')
invalid = 1
if invalid:
print _('You must fix the preceding invalid addresses first.')
sys.exit(1)

I think having a command line option for this would be fantastic - something like "-i" ("ignore invalid email addresses"), which if selected makes sure that the script simply ignores invalid email addresses, and basically "always works" (unless of course the mailing list name is wrong, etc.).

I don't know python at all (shame on me), or I swear I'd be submitting a patch (I am a Drupal developer, and submit patches whenever I can).

Thank you!!!

Merc.

Discussion


Log in to post a comment.