[Zope-CMF] CMF Question

Tres Seaver tseaver@zope.com
Mon, 11 Mar 2002 10:31:52 -0500 (EST)


On Fri, 1 Mar 2002 Paul_Merrill@amp.com.au wrote:

> Dear All,
>
> I note that the 1.2 version of CMF has a good news site and membership
> list. I'm wondering whether if I add a new news item whether CMF can sent
> an email of the item to all the members. I'm very interested in a threaded
> discussion group, like CMF or SquishDot but I need to notify people in the
> group that a posting has been made, similar to mailman. If I must, I'll use
> mailman but I really want to only use zope components.
>
> Can anyone provide feedback to my email?

It would be possible to write such a component:  for instance,
the default memberdata tool has a method, 'searchMemberDataContents',
which returns a sequence of '( name, email )' tuples for all members
matching a search term;  you could write an ExternalMethod to call
this method (it is declared private) and then use the tuples to send
mail using the '<dtml-sendmail>' tag.

The ExternalMethod would look something like::

  from Products.CMFCore.utils import getToolByName

  def listMemberEmails( self ):
      """
          Return a list of '( name, email )' tuples for all members.
      """
      mdtool = getToolByName( self, 'portal_memberdata' )
      return mdtool.searchMemberDataContents( search_param='email'
         search_term='@' )

Tres.
-- 
===============================================================
Tres Seaver                                tseaver@zope.com
Zope Corporation      "Zope Dealers"       http://www.zope.com