[Zope] Send the event -new by email
Dieter Maurer
dieter@handshake.de
Wed, 25 Sep 2002 21:15:29 +0200
varro@iol.it writes:
> I'm using zope 5.1 + cmf 1.3 plone 1.0 beta
>
> I saw that with "sendmail" I can send email by HostMail object...
Please be more careful, when you describe problems.
You mean "Mailhost" rather than "HostMail".
> But, How can i access to all member's email?
You pass the "To" information inside the message as a "To" header:
<dtml-sendmail mailhost=...>
To: <dtml-var expr="'address1, address2, ...'">
From: ...
Subject: ...
....
</dtml-sendmail>
Note, that the mail headers must start in column 1!
Now to the second part of your problem: how to get the list
of email addresses:
I can give you only a partial answer (because I am too lazy to
look up the required details).
I expect, "portal_membership" has a method to return the list
of members. Say, it would be "getMembers" (may have a different name,
use e.g. "DocFinder" to find it out).
Then you could use something like:
<dtml-var expr="','.join([m.email for m in portal_membership.getMembers() if m.email])">
The "[...]" is a so called list generator. You find details in the Python
documentation.
Dieter