Hi all,
I have the following code in a python script, that allows to list all
members in my site to send a mail to all of them.
mailList=[]
mailRecipients=""
description='Hello World'
for item in context.portal_membership.listMembers():
if item.email !='':
mailList.append(item.email)
for element in mailList:
mailRecipients = mailRecipients + element + ','
context.mail_newsitem(recipients=mailRecipients,description=description)
The last line calls to a dtml-method that does the following
<dtml-sendmail smtphost="mx.upf.edu">
To: mail@server.com
From: noReply@server.com
Subject: <dtml-var subject>
<dtml-var body>
</dtml-sendmail>
It works when I have no groups, but now, I have inserted two groups of
users; "developers" and "providers".
I want to send mail to all users belonging to developers only or all
members
belonging to providers. How could I get only the list of members
belonging
to each group and send the mail?
Thanks in advance.
Víctor