E-mail notification for scripted Plone users

Here’s a little something that I googled and googled for but never found:

I was using Andy McKay’s script for adding users in bulk from The Definitive Guide to Plone (1st edition). It’s a great little script, but I needed to send the newly created users an e-mail to notify them of the new account. Long story short, the key is the registeredNotify() method available on the portal_registration tool:

def importUsers(self):
 reader = csv.reader(open(fileName, "r"))
 pr = self.portal_registration


# send e-mail notifying user

That’s it. registerNotify() is the same method that {portal_url}/join_form uses to send an e-mail with a link to create a new password. Just add those two lines into the script and you’re cookin’.

Leave a Reply

Your email address will not be published.

= 3 + 5