I made a variable 'mail_group' which appears in <dtml-var REQUEST> as: ['first last <person@here.com>','first2 last2 <person2@there.com>'] and I want to use <dtml-sendmail> so I have: <dtml-let addr="_.string.join(mail_group,',')"> <dtml-sendmail mailhost="MailHost"> To: <dtml-var addr html_quote> Subject: Feedback from somewhere from: trying@somewhere.com Comments:<dtml-var comments> </dtml-sendmail> </dtml-let> But I'm getting totally impenetrable errors: <dtml-var addr html_quote> renders perfectly to: first last <person@here.com.,first2 last2 <person2@there.com> and if I cut and paste the above line to the 'To:' field, mail is sent perfectly. BUT when i run the above sendmail script I get a page that says only: {'first': (550, '5.1.1 ... User unknown')} If there is just one name in 'mail_group' I get an even weirder page: {'f': (550, '5.1.1 ... User unknown'), 'i': (550, '5.1.1 ... User unknown'), 'r': (550, '5.1.1 ... User unknown'), 's': (550, '5.1.1 ... User unknown', 't': (550, '5.1.1 ... User unknown')} I am totally perplexed. And SUPER frustrated. Can someone tell me why this is and how to fix it if possible. thanks joshua p.s. if I use To: <dtml-in mail_group><dtml-var sequence-item><dtml-var addr html_quote><dtml-unless sequence-end>, </dtml-unless></dtml-in> I get an error like: Error Type: TypeError Error Value: len() of unsized object which I think is because of trailing spaces though I can't see any...
Hi Joshua, try it with mail_group = ['"first last" <person@here.comY', '"first2 last2" <person2@there.com>'] and report if it works. Regards, Dirk Joshua Newman schrieb:
I made a variable 'mail_group' which appears in <dtml-var REQUEST> as: ['first last <person@here.com>','first2 last2 <person2@there.com>']
and I want to use <dtml-sendmail> so I have:
<dtml-let addr="_.string.join(mail_group,',')"> <dtml-sendmail mailhost="MailHost">
To: <dtml-var addr html_quote> Subject: Feedback from somewhere from: trying@somewhere.com Comments:<dtml-var comments>
</dtml-sendmail> </dtml-let>
But I'm getting totally impenetrable errors:
<dtml-var addr html_quote> renders perfectly to: first last <person@here.com.,first2 last2 <person2@there.com>
and if I cut and paste the above line to the 'To:' field, mail is sent perfectly.
BUT when i run the above sendmail script I get a page that says only: {'first': (550, '5.1.1 ... User unknown')}
If there is just one name in 'mail_group' I get an even weirder page:
{'f': (550, '5.1.1 ... User unknown'), 'i': (550, '5.1.1 ... User unknown'), 'r': (550, '5.1.1 ... User unknown'), 's': (550, '5.1.1 ... User unknown', 't': (550, '5.1.1 ... User unknown')}
I am totally perplexed. And SUPER frustrated. Can someone tell me why this is and how to fix it if possible.
thanks joshua
p.s. if I use To: <dtml-in mail_group><dtml-var sequence-item><dtml-var addr html_quote><dtml-unless sequence-end>, </dtml-unless></dtml-in>
I get an error like: Error Type: TypeError Error Value: len() of unsized object
which I think is because of trailing spaces though I can't see any...
_______________________________________________ Zope maillist - Zope@zope.org 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 )
Finally, success!! After only 3 days of working on this... Here is the code to build the variable 'mail_group' in a form of checkboxes for indicating the recipients of the mail. ('Residents' is a folder containg: several of the ZClass 'Resident' with properties first_name, last_name, and email_address et. al.; all strings). <form action="SendFeedback" method="post"> <dtml-in "Residents.objectValues('Resident')" sort=last_name > <INPUT TYPE="checkbox" NAME="mail_group:list" value=""<dtml-var first_name> <dtml-var last_name>" <<dtml-var email_address>>"> <dtml-var first_name> <dtml-var last_name> <dtml-var email_address><br> </dtml-in> Type your comments here <br> <textarea name="comments" rows="10" cols="50"> </textarea><br> <input type="submit" value="Send Feedback"> </form> (you need the ':list' in NAME="mail_group:list" to convert the case of only a single checked box from a string to a list) " is " < is < > is > This makes a mail_group variable ['"first last" <name@where.com>','"first2 last2" <name2@here.com>"',...] Then the dtml send method 'SendFeedback' is: <dtml-let addr="_.string.join(mail_group,', ')"> <dtml-sendmail mailhost="MailHost"> To: <dtml-var addr> Subject: whatever From: whoever@wherever.com Comments:<dtml-var comments> </dtml-sendmail> </dtml-let> This works only because <dtml-var addr> within sendmail renders things perfectly: "first last" <name@where.com>,... But outside the sendmail tags <dtml-var addr> renders as: first last, first2 last2,... unless I put <dtml-var html_quote> when it renders as "first last" <name@where.com>,... But strangely when I write: To:<dtml-var html_quote> in the sendmail form, I get that bizarre error message from my previous posting: {'"': (550, '5.1.1 <">... User unknown')} ' So I would love to know why this works. Simply being enclosed in <dtml-sendmail> shouldn't allow <dtml-var> to render html characters but it does, and I'm glad it does. I couldn't find any documentation on <dtml-sendmail> and I don't understand the stuff under the hood from python-->zope-->html-->sendmail--> So I'll just use it and won't anger the gods... But if anyone can tell me why, I would love to know. The take home lesson is: REMEMBER The HTML Coded Character Set at http://www.w3.org/MarkUp/html-spec/html-spec_13.html (and elsewhere) if you want to format things in the middle of html. It seems the only way to mix dtml syntax with html. Thanks again for the help Dirk. You had the right idea. Execution was just much trickier than I had expected. Also thanks to Amos with his sendmail mailform how-to: http://www.zope.org/Documentation/How-To/MailForm joshua Zope can be like a skittish lover, sometimes it can be so withholding, but if you say the right things, it really puts out.
participants (2)
-
Dirk Datzert -
Joshua Newman