[Zope] RE: sendmail and variable mailto

Jeffrey P Shell jeffrey@Digicool.com
Sat, 13 Feb 1999 19:35:04 -0500


> This won't do. I really need to be able to send mail using only the
> received variable, and no folder properties; at least no dynamic ones.

the REQUEST variable has the attribute 'form', which contains only the
passed-in values in a form.  For example,

<!--#var "REQUEST.form['email_address']"-->

will _only_ get the email address from the form.

I don't understand why you're trying to set the folders property if it
constantly gets overwritten with each request.  In any case, if two people
access a page at the same time and that page modifies a property, the
transaction (the entire process from when Zope recieves the REQUEST to when
it sends out RESPONSE) is atomic.  That is, if Person A hits first, all of
his transactions will be carried out and used beforer Person B can.  Unless
you're using ZServer, Zope really only handles one request at a time.

In regards to what I think you're trying to do with the sendmail tag, you
don't have to use the 'mailto' and 'mailfrom' parameters.  The only
parameter you really need is the ID of the mailhost or the IP address of
the SMTP host.  To do dynamic to's and from's and even subjects, do the
following:

<!--#sendmail mailhost=foohost-->
to: <!--#var email_address-->
from: <!--#var our_address-->
subject: congratulations on your furby addiction!

message
<!--#/sendmail-->

The sendmail tag process all the headers and uses the "to" and "from"
headers evaluated values if mailto and/or mailfrom aren't set.  If mailto
and mailfrom are used, they don't necessarily show up in the message when
its recieved as the mailto and mailfrom values are used to talk with SMTP.

It's important to note that the headers and the body of the message must be
seperated by a blank line.  You can use any header in the header area you
wish (like x-mailer: Zope_Is_King 1.10), Zope only cares about the to and
from values.  And again, only if the mailto/mailfrom parameters aren't in
the tag itself.

The code in the sendmail tag is rather old and we're open to new
patches/mods people make (like using SMTP lib!).  The
mailto/mailfrom/subject parameters currently only evaluate their values as
strings and don't look them up from the namespace.

.jPS | jeffrey@digicool.com | http://www.zope.org/