<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 <<a href="mailto:jmeile@hotmail.com">jmeile@hotmail.com</a>> 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'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>
<dtml-let email="REQUEST.get('aba_email_txt').encode('utf-8')"<br>
name="REQUEST.get('aau_name_txt').encode('utf-8')"<br>
lastName="REQUEST.get('aat_vorname_txt').encode('utf-8')"<br>
company="REQUEST.get('aas_firma_txt').encode('utf-8')"<br>
file1="REQUEST.get('aap_dateien_anhang_dat')"<br>
file2="REQUEST.get('aaq_dateien_anhang_dat')"<br>
file3="REQUEST.get('aar_dateien_anhang_dat')"><br>
<br>
<dtml-sendmail smtphost="<a href="http://my_host.my_domain.com" target="_blank">my_host.my_domain.com</a>"><br>
To: <a href="mailto:my_mail@my_domain.com">my_mail@my_domain.com</a><br>
From: &dtml-email;<br>
Subject: Anfrage &dtml-name; &dtml-lastName; - &dtml-company;<br>
Content-Type: text/html; charset=utf-8<br>
<dtml-mime type="text/html; charset=utf-8"><br>
<html><br>
<body><br>
Some html code comes here<br>
</body><br>
</html><br>
<dtml-boundary type="application/octet-stream" disposition="attachment"<br>
filename_expr="file1.filename"<br>
><dtml-var "file1.read()"><dtml-boundary type="application/octet-stream"<br>
disposition="attachment"<br>
filename_expr="file2.filename"<br>
><dtml-var "file2.read()"><dtml-boundary type="application/octet-stream"<br>
disposition="attachment"<br>
filename_expr="file3.filename"<br>
><dtml-var "file3.read()"></dtml-mime><br>
</dtml-sendmail><br>
</dtml-let><br>
<br>
Let's say that the user doesn't submit file3, on that case, zope will<br>
generate something like this: "some_ramdom_id.dat" and it will attach<br>
an empty file. I tried something like this:<br>
<br>
<dtml-if "file1.filename not in ['', None]"><dtml-boundary<br>
type="application/octet-stream" disposition="attachment"<br>
filename_expr="file1.filename"<br>
><dtml-var "file1.read()"></dtml-if><br>
<br>
However when I try to save, zope fails and says:<br>
<br>
"""<br>
Error Type: Document Template Parse Error<br>
Error Value: Unexpected tag, for tag <dtml-boundary<br>
type="application/octet-stream" disposition="attachment"<br>
filename_expr="file1.filename" >, on line 215 of sendAnfrage<br>
"""<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>
{'name': real_name_or_dummy_name, 'data': <file.read()>_or_dummy_text}<br>
<br>
So, I feed the boundary with a dummy file when no file was uploaded. I don'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'm working in the zmi and I'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't an option on this case.<br>
<br>
Best regards<br>
Josef<br>
<br>
_______________________________________________<br>
Zope maillist - <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>
** No cross posts or HTML encoding! **<br>
(Related lists -<br>
<a href="http://mail.zope.org/mailman/listinfo/zope-announce" target="_blank">http://mail.zope.org/mailman/listinfo/zope-announce</a><br>
<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>