[Zope] sendmail implementation problem
Dieter Maurer
dieter@handshake.de
Tue, 16 Jan 2001 20:26:27 +0100 (CET)
Lee writes:
> ... several recipients from form to sendmail ...
I just skipped your question. Not sure, that I got it right.
DTML does not have true variables with assignments.
However, you can use the REQUEST object as a variable container.
If your problem is to collect all recipients from the form
and feed them to "sendmail" you could do something like this:
<dtml-call "REQUEST.set(recipients,[])">
<dtml-in "REQUEST.form.items()">
...
<dtml-call "recipients.append(_['sequence-item'])">
...
</dtml-in>
<dtml-sendmail ...>
To: <dtml-var "_.string.join(recipients,', ')>
....
</dtml-sendmail>
You can even let ZPublisher form the list for you:
give all form variables that will contain a recipient
the name "recipients:list:ignore_empty"
Then, if at least one of these fields got a value,
you REQUEST will have a variable "recipients" containing
a list with all these fields.
I would like to point you to Python's "in" operator.
Instead of
_['sequence-key'] == 'message') or
or (_['sequence-key'] == 'sender') or (_['sequence-key'] ==
'senderEmail') or (_['sequence-key'] == 'subject')
you can write:
_['sequence-key'] in ('message','sender','senderEmail','subject')
Easier to write and to read.
Dieter