<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html;charset=ISO-8859-1" http-equiv="Content-Type">
<title></title>
</head>
<body bgcolor="#ffffff" text="#000000">
Hi all,<br>
<br>
I have the following code in a python script, that allows to list all<br>
members in my site to send a mail to all of them.<br>
<br>
mailList=[]<br>
mailRecipients=""<br>
description='Hello World'<br>
for item in context.portal_membership.listMembers():<br>
if item.email !='':<br>
mailList.append(item.email)<br>
<br>
for element in mailList:<br>
mailRecipients = mailRecipients + element + ','<br>
context.mail_newsitem(recipients=mailRecipients,description=description)<br>
<br>
The last line calls to a dtml-method that does the following<br>
<br>
<dtml-sendmail smtphost="mx.upf.edu"><br>
To: <a href="mailto:mail@server.com">mail@server.com</a><br>
From: <a href="mailto:noReply@server.com">noReply@server.com</a><br>
Subject: <dtml-var subject><br>
<br>
<dtml-var body><br>
<br>
<br>
</dtml-sendmail><br>
<br>
It works when I have no groups, but now, I have inserted two groups of<br>
users; "developers" and "providers".<br>
<br>
I want to send mail to all users belonging to developers only or all
members<br>
belonging to providers. How could I get only the list of members
belonging<br>
to each group and send the mail?<br>
<br>
Thanks in advance.<br>
<br>
Víctor<br>
</body>
</html>