Re: [Zope] sendmail implementation problem
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 ___ Zope maillist - [EMAIL PROTECTED] http://lists.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope-dev )
Re: [Zope] sendmail implementation problem
Hi Dieter, Thanks again for your help :) I'm having some trouble creating the new variable in REQUEST - maybe you know why? The REQUEST object holds: KEY ITEM lreilly lreilly (recipient - '@cs.strath.ac.uk' is appended) ltlyer ltyler (recipient - '@cs.strath.ac.uk' is appended) subject subject sender sender message message senderEmail senderEmail But when I add in the code to create 'recipients' in the REQUEST object and then try and view REQUEST's contents again I get an error: Error Type: NameError Error Value: recipients Here's the method: ``,, dtml-var standard_html_header dtml-call "REQUEST.set(recipients,[])" dtml-in "REQUEST.form.items()" dtml-if expr="_['sequence-key'] in ('message','sender','senderEmail','subject')" input type="hidden" name="dtml-var name="sequence-key"" value="dtml-var name="sequence-item"" dtml-else dtml-call "recipients.append(_['sequence-key'])" /dtml-if /dtml-in dtml-in expr="REQUEST.form.items()" dtml-var name="sequence-key": dtml-var name="sequence-item"br /dtml-in dtml-var standard_html_footer ``,, Can you see any obvious problems? Thanks very much for your time. - Best regards, Lee -- Lee Reilly mailto:[EMAIL PROTECTED] ```` HAVE SKILLS; WILL TRAVEL. I'm currently looking for an internship in the USA in the field of web development. Ideally, I'm looking for a placement for 3 to 18 months. Can you help? More details, my resume, etc. @ http://homepages.strath.ac.uk/~aeu97172/ /shameless plug ___ Zope maillist - [EMAIL PROTECTED] http://lists.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope-dev )
[Zope] sendmail implementation problem
Hi, This is more of an implementation problem that anything else, which is probably starightforward enough for those with more experience that myself. The simplified version is as follows: Form A collects usernames and send these to Form B. Form B takes the input parameters from the REQUEST object and places them in 'hidden' form inputs with name="username" and provides some input textfields prompting for 'subject', 'message', etc. These are submitted to Form C Form C displays all the parameters in the REQUEST object and gives a view of what the email will look like, e.g. +---= | To: [EMAIL PROTECTED] | | From: [EMAIL PROTECTED], [EMAIL PROTECTED] | | Subject: Zope | | | | My message here | | | +---= Everything (bar the recipients) can be specifided using dtml-var subject, etc. as required but as the usernames in the hidden field are passed into a method, which does not know their names; I have to get them from the REQUEST object again. I have produced the following code to collect all the usernames (used to creat recipients email address); dtml-in expr="REQUEST.form.items()" dtml-if expr="(_['sequence-key'] == 'message') or (_['sequence-key'] == 'message') or (_['sequence-key'] == 'sender') or (_['sequence-key'] == 'senderEmail') or (_['sequence-key'] == 'subject')" dtml-elsedtml-var name="sequence-key": dtml-var name="sequence-item" /dtml-if /dtml-in So displaying the email is easy but how can I send this to my sendmail method? 1 - Simply collect all the usernames, variables in hidden fields and send them onto sendmail? 2 - or is there a way to CALL my sendmail method for each individual recipient (email address) from this method simply by hitting a SUBMIT button? Which is the easiest/most efficient way to go about this? Ideally, I want the email dislayed (like it's formatted above) and then just simply hit a submit button to send it to multiple recipients. I'd rather not have something like 'lee.reilly@ntlworld, [EMAIL PROTECTED]' in the 'To:' field - just multiple, individual emails. It's late - but I hope that makes sense(?). Thanks very much for any guidance you can give me! - Best regards, Lee -- Lee Reilly mailto:[EMAIL PROTECTED] ```` HAVE SKILLS; WILL TRAVEL. I'm currently looking for an internship in the USA in the field of web development. Ideally, I'm looking for a placement for 3 to 18 months. Can you help? More details, my resume, etc. @ http://homepages.strath.ac.uk/~aeu97172/ /shameless plug ___ Zope maillist - [EMAIL PROTECTED] http://lists.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope-dev )