Re:Sendmail Error.It works for me.
Hi, I have used dtml-sendmail with multiple To: addresses,fetched from the database without any problems. After you fetch the email Object list from the data Base, convert the object List into a list of strings and join the list with commas.Then use the dtml-sendmail tag to send the mail. You can do this,assuming your sql_query returns a list of Emails. Assuming that your query is called sql_get_emails,and it contains a field called email,do this, <dtml-call "REQUEST.set('mylist',[])"> <dtml-in sql_get_emails> <dtml-call "mylist.append(email)"> </dtml-in> <dtml-let mailString="_.string.join(mylist,',')" > Now use this mailString to send the mail. I do this,after fetching mailString, <dtml-sendmail smtphost="mail.pepco.no"> To: <dtml-var mailString> From: <dtml-var from> Subject: <dtml-var subject> <dtml-var body> </dtml-sendmail> </dtml-let> I hope that you dont get frustrated after this. Bye, A.R.K
Thanks Karthick (and all others who have contributed suggestions). Although I don't fully understnad the syntax, I'll have a go at this tomorrow (when I get some energy back!). But what really confuses me is why I still get the spacey error when I hard code all of the sendmail data. And yet it looks OK when I send it to the screen with the "pre" tag (BTW, what IS a "pre" tag?) Phew! Steve -----Original Message----- From: zope-admin@zope.org [mailto:zope-admin@zope.org]On Behalf Of karthick ramanarayanan Sent: Wednesday, March 21, 2001 11:46 PM To: ssmith6@bigpond.net.au Cc: zope@zope.org Subject: [Zope] Re:Sendmail Error.It works for me. Hi, I have used dtml-sendmail with multiple To: addresses,fetched from the database without any problems. After you fetch the email Object list from the data Base, convert the object List into a list of strings and join the list with commas.Then use the dtml-sendmail tag to send the mail. You can do this,assuming your sql_query returns a list of Emails. Assuming that your query is called sql_get_emails,and it contains a field called email,do this, <dtml-call "REQUEST.set('mylist',[])"> <dtml-in sql_get_emails> <dtml-call "mylist.append(email)"> </dtml-in> <dtml-let mailString="_.string.join(mylist,',')" > Now use this mailString to send the mail. I do this,after fetching mailString, <dtml-sendmail smtphost="mail.pepco.no"> To: <dtml-var mailString> From: <dtml-var from> Subject: <dtml-var subject> <dtml-var body> </dtml-sendmail> </dtml-let> I hope that you dont get frustrated after this. Bye, A.R.K _______________________________________________ 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 )
The only thing to consider is whether you want each user to know what other users the mail was sent to. You can put the whole string in the bcc column to initiate it as one call to the mail server, but show each person they were bccd OR you can use the <dtml-in> loop over the whole sendmail block so each person is mailed individually. Its pretty much a breach of company/client trust to allow clients to see what other clients are in the list, pending the type of information sent. Only problem with <dtml-in is large batches will eventually raise an error if too big. I think you can bypass that by writing it into an external script. Cheers, Paz karthick ramanarayanan wrote:
Hi, I have used dtml-sendmail with multiple To: addresses,fetched from the database without any problems. After you fetch the email Object list from the data Base, convert the object List into a list of strings and join the list with commas.Then use the dtml-sendmail tag to send the mail. You can do this,assuming your sql_query returns a list of Emails. Assuming that your query is called sql_get_emails,and it contains a field called email,do this,
<dtml-call "REQUEST.set('mylist',[])"> <dtml-in sql_get_emails> <dtml-call "mylist.append(email)"> </dtml-in> <dtml-let mailString="_.string.join(mylist,',')" > Now use this mailString to send the mail. I do this,after fetching mailString,
<dtml-sendmail smtphost="mail.pepco.no"> To: <dtml-var mailString> From: <dtml-var from> Subject: <dtml-var subject> <dtml-var body> </dtml-sendmail> </dtml-let>
I hope that you dont get frustrated after this.
Bye, A.R.K
_______________________________________________ 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 )
participants (3)
-
karthick ramanarayanan -
Paul Zwarts -
Steve Smith