<br>The email library should be available to use with a Script (Python) and can be done all within the ZMI. Otherwise maybe use dtml-try?<br><br><div class="gmail_quote">On Wed, Apr 9, 2008 at 4:40 PM, Josef Meile &lt;<a href="mailto:jmeile@hotmail.com">jmeile@hotmail.com</a>&gt; wrote:<br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">Dear list<br>
<br>
I&#39;m trying to send a multi-part email after having submitted a<br>
form. In that form, the user will give some basic information<br>
from him, then he will be able to send at most three files.<br>
<br>
This is my dtml-method to send email after having submitted the<br>
data:<br>
<br>
&lt;dtml-let email=&quot;REQUEST.get(&#39;aba_email_txt&#39;).encode(&#39;utf-8&#39;)&quot;<br>
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;name=&quot;REQUEST.get(&#39;aau_name_txt&#39;).encode(&#39;utf-8&#39;)&quot;<br>
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;lastName=&quot;REQUEST.get(&#39;aat_vorname_txt&#39;).encode(&#39;utf-8&#39;)&quot;<br>
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;company=&quot;REQUEST.get(&#39;aas_firma_txt&#39;).encode(&#39;utf-8&#39;)&quot;<br>
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;file1=&quot;REQUEST.get(&#39;aap_dateien_anhang_dat&#39;)&quot;<br>
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;file2=&quot;REQUEST.get(&#39;aaq_dateien_anhang_dat&#39;)&quot;<br>
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;file3=&quot;REQUEST.get(&#39;aar_dateien_anhang_dat&#39;)&quot;&gt;<br>
<br>
&lt;dtml-sendmail smtphost=&quot;<a href="http://my_host.my_domain.com" target="_blank">my_host.my_domain.com</a>&quot;&gt;<br>
To: <a href="mailto:my_mail@my_domain.com">my_mail@my_domain.com</a><br>
From: &amp;dtml-email;<br>
Subject: Anfrage &amp;dtml-name; &amp;dtml-lastName; - &amp;dtml-company;<br>
Content-Type: text/html; charset=utf-8<br>
&lt;dtml-mime type=&quot;text/html; charset=utf-8&quot;&gt;<br>
&lt;html&gt;<br>
 &nbsp;&lt;body&gt;<br>
 &nbsp; &nbsp;Some html code comes here<br>
 &nbsp;&lt;/body&gt;<br>
&lt;/html&gt;<br>
&lt;dtml-boundary type=&quot;application/octet-stream&quot; disposition=&quot;attachment&quot;<br>
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; filename_expr=&quot;file1.filename&quot;<br>
&gt;&lt;dtml-var &quot;file1.read()&quot;&gt;&lt;dtml-boundary type=&quot;application/octet-stream&quot;<br>
disposition=&quot;attachment&quot;<br>
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; filename_expr=&quot;file2.filename&quot;<br>
&gt;&lt;dtml-var &quot;file2.read()&quot;&gt;&lt;dtml-boundary type=&quot;application/octet-stream&quot;<br>
disposition=&quot;attachment&quot;<br>
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; filename_expr=&quot;file3.filename&quot;<br>
&gt;&lt;dtml-var &quot;file3.read()&quot;&gt;&lt;/dtml-mime&gt;<br>
&lt;/dtml-sendmail&gt;<br>
&lt;/dtml-let&gt;<br>
<br>
Let&#39;s say that the user doesn&#39;t submit file3, on that case, zope will<br>
generate something like this: &quot;some_ramdom_id.dat&quot; and it will attach<br>
an empty file. I tried something like this:<br>
<br>
&lt;dtml-if &quot;file1.filename not in [&#39;&#39;, None]&quot;&gt;&lt;dtml-boundary<br>
 &nbsp;type=&quot;application/octet-stream&quot; disposition=&quot;attachment&quot;<br>
 &nbsp;filename_expr=&quot;file1.filename&quot;<br>
&gt;&lt;dtml-var &quot;file1.read()&quot;&gt;&lt;/dtml-if&gt;<br>
<br>
However when I try to save, zope fails and says:<br>
<br>
&quot;&quot;&quot;<br>
Error Type: Document Template Parse Error<br>
Error Value: Unexpected tag, for tag &lt;dtml-boundary<br>
type=&quot;application/octet-stream&quot; disposition=&quot;attachment&quot;<br>
filename_expr=&quot;file1.filename&quot; &gt;, on line 215 of sendAnfrage<br>
&quot;&quot;&quot;<br>
<br>
The only way I found to cope with this was doing a script to validate if a<br>
file has whether a name or not, then I will return a dictionary like this:<br>
{&#39;name&#39;: real_name_or_dummy_name, &#39;data&#39;: &lt;file.read()&gt;_or_dummy_text}<br>
<br>
So, I feed the boundary with a dummy file when no file was uploaded. I don&#39;t<br>
really like to send dummy files since it may confuse the person receiving<br>
the emails. Is there any better way of achieving this? Please note that<br>
since I&#39;m working in the zmi and I&#39;m not the administrator of the machine<br>
where my page is hosted, I can only use dtml to send mail :-(, thus using<br>
the python mail library isn&#39;t an option on this case.<br>
<br>
Best regards<br>
Josef<br>
<br>
_______________________________________________<br>
Zope maillist &nbsp;- &nbsp;<a href="mailto:Zope@zope.org">Zope@zope.org</a><br>
<a href="http://mail.zope.org/mailman/listinfo/zope" target="_blank">http://mail.zope.org/mailman/listinfo/zope</a><br>
** &nbsp; No cross posts or HTML encoding! &nbsp;**<br>
(Related lists -<br>
&nbsp;<a href="http://mail.zope.org/mailman/listinfo/zope-announce" target="_blank">http://mail.zope.org/mailman/listinfo/zope-announce</a><br>
&nbsp;<a href="http://mail.zope.org/mailman/listinfo/zope-dev" target="_blank">http://mail.zope.org/mailman/listinfo/zope-dev</a> )<br>
</blockquote></div><br>