[Zope] Mass Mailing (newbie)

Gregory Haley ghaley@venaca.com
Tue, 24 Oct 2000 10:39:41 -0400


hi yvonne,

you can use the zope send mail method to pull data from a database.  the
problem
is with pulling in the text.  sendmail appears to send only literal
text, i.e., it does not parse html markup.  we are using a mysql
database to pull text and a second to pull names and emails, etc.  to
prevent the text from coming out as a single string, i have an external
python method that takes the string of text and writes out the lines as
lines of <= 75 chars, it also reinserts double line breaks,
as in between paragraphs.  

we use something like this:

you will need the MailHost product, and you will need to add a sendmail
method in your directory.  

ciao!
greg.

DBA/web programmer
venaca.com

***********************************************************************
 
<dtml-in get_prs>
  <dtml-call "REQUEST.set('z_subject', pr_subject)">
  <dtml-call "REQUEST.set('z_title',title)">
  <dtml-call "REQUEST.set('msg',pr_content)">

<dtml-in get_addresses>

<dtml-sendmail mailhost="MailHost"> 
To:  <dtml-var name> <<dtml-var email>>
From: <yabba@dabba.do>
Subject: <dtml-var z_subject>

<dtml-var z_title>

<dtml-in "clean_content(msg)">
<dtml-var sequence-item>
</dtml-in>
</dtml-sendmail>

</dtml-in>
</dtml-in>

"clean_content" is the name of the python external method.

This may not be ALL of the code, as i am really chopping some things out
of the actual dtml file for illustrative purposes.

a couple of warnings, in case you haven't used dtml sendmail.  you can
use nice indented tags within a <dtml-in> or <dtml-if> but not other
wise.  the left margin is, in my experience anyway, fairly inviolable.

as this is working now, if sendmail gets a bad address, it strangles
everything from the point of the error forward.  so, you should check to
make sure your emails are exactly correct -- i was doing a bulk mailing
of about 100 emails, and it died after the 6th one.

i don't know how to put in a trap into the method so that the mail
server catches the return mail but does not pass them to the zope
mailhost.  

ciao!
greg. 

> Yvonne Totty wrote:
> 
> Hi!
> 
> I need to send out mass mailings from time to time
> (newsletters, announcements and the such).
> 
> Is there an easy way to get this done? I already
> have the email addy's in the database.
> 
> TIA,
> Yvonne
> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> Yvonne Totty
> Database Engineer
> -------------------------
> Wolverine: You actually go outside in these things?
> Cyclops: Well, what would you prefer? Yellow spandex?
>