[Zope] File Attachment Again....
SERVEL Yannick
SERVELYM@cardiff.ac.uk
Thu, 29 Apr 1999 16:47:42 +0100
------=_NextPart_000_004B_01BE925F.FFFFDFA0
Content-type: text/plain; charset="iso-8859-1"
Content-transfer-encoding: quoted-printable
Hi everybody.
I am meeting several problems about the creation of the file =
attachment...
Here is the Send_Mail dtml document
<!--#var standard_html_header-->
<!--#var file-->
<!--#var =
"Smtp_send_func(smtp_server=3DDomain_Name,tolist=3D[support],msg=3Dbody,s=
ubject=3Dsubject,fromme=3Dfromme,file=3Dfile,REQUEST=3DREQUEST)"-->
<br>
<CENTER><H1>Message Sent</H1>
<br>
<a href=3D"S_Compose_Mail?Domain_Name=3D<!--#var =
Domain_Name-->&login=3D<!--#var login-->"><IMG SRC=3D"back" =
border=3D0></a></CENTER>=20
<!--#var standard_html_footer-->
And here is the python smtp.py source file:
def =
smtp_send(self,smtp_server=3DNone,tolist=3DNone,msg=3DNone,subject=3DNone=
,fromme=3DNone,file=3D'',REQUEST=3DNone):
smtp=3Dsmtplib.SMTP(smtp_server)
msg=3D"Subject: " + subject + "\n\r" +msg
smtp.sendmail(fromme,tolist,msg)
smtp.quit()
s=3D''
=09
s=3Ds+file.read()
return s
But it deosn't work...
<HTML><HEAD><TITLE>yannick</TITLE></HEAD><BODY BGCOLOR=3D"#FFFFFF">
<TABLE BORDER=3D"0" WIDTH=3D"100%">
<TR>
<TD WIDTH=3D"10%" ALIGN=3D"CENTER">
<STRONG><FONT SIZE=3D"+6" COLOR=3D"#77003B">!</FONT></STRONG>
</TD>
<TD WIDTH=3D"90%"><BR>
<FONT SIZE=3D"+2">System Unavailable</FONT>
<P>This site is currently experiencing technical difficulties.=20
Please contact the site administrator for more information. For
additional technical information, please refer to the HTML source for =
this
page. Thank you for your patience.</P>
</TD>
</TR>
</TABLE>
<!--
Error type: =20
Error value: read-only buffer, class
-->
</BODY></HTML>
<!--
Traceback (innermost last):
File C:\Program Files\servel\lib\python\ZPublisher\Publish.py, line =
877, in publish_module
File C:\Program Files\servel\lib\python\ZPublisher\Publish.py, line =
590, in publish
(Info: /servel/Send_Mail)
File C:\Program Files\servel\lib\python\OFS\DTMLDocument.py, line 212, =
in __call__
(Object: Send_Mail)
File C:\Program Files\servel\lib\python\OFS\DTMLDocument.py, line 208, =
in __call__
(Object: Send_Mail)
File C:\Program Files\servel\lib\python\DocumentTemplate\DT_String.py, =
line 513, in __call__
(Object: Send_Mail)
File C:\Program Files\servel\lib\python\DocumentTemplate\DT_Util.py, =
line 266, in eval
(Object: =
Smtp_send_func(smtp_server=3DDomain_Name,tolist=3D[support],msg=3Dbody,su=
bject=3Dsubject,fromme=3Dfromme,file=3Dfile,REQUEST=3DREQUEST))
File <string>, line 0, in ?
File C:\Program =
Files\servel\lib\python\Products\ExternalMethod\ExternalMethod.py, line =
254, in __call__
(Object: CopySource)
(Info: ((), {'subject': '"Et maintenant admire la puissante de =
feu de ma STATION"', 'smtp_server': 'd032.ml.ucwm.ac.uk', =
'REQUEST': form:
subject: '"Et maintenant admire la puissante de feu de ma =
STATION"'
Domain_Name: 'd032.ml.ucwm.ac.uk'
support: 'wmlyms'
file: <ZPublisher.Publish.FileUpload instance at 964fc20>
login: 'wmlyms'
fromme: 'ah@serveland.com'
body: ' we'
environ:
HTTP_ACCEPT_ENCODING: 'gzip, deflate'
REMOTE_HOST: 'localhost'
PATH_INFO: '/servel/Send_Mail'
CONTENT_LENGTH: '1217'
SERVER_PROTOCOL: 'HTTP/1.0'
CONTENT_TYPE: 'multipart/form-data; =
boundary=3D---------------------------7cf3bda36301c0'
PATH_TRANSLATED: =
'C:\\NT\\Profiles\\wmlyms.000\\Desktop\\servel\\Send_Mail'
HTTP_HOST: 'localhost:9673'
REQUEST_METHOD: 'POST'
HTTP_COOKIE: 'dtpref_rows=3D"25"; =
dtpref_cols=3D"90"; tree-s=3D"eJyLjjaMjQUABOIBog"'
SCRIPT_NAME: ''
SERVER_SOFTWARE: 'ZopeHTTP/1.16 Python/1.5.1'
HTTP_ACCEPT_LANGUAGE: 'en-us'
HTTP_ACCEPT: 'image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, =
application/msword, application/vnd.ms-excel, =
application/vnd.ms-powerpoint, */*'
GATEWAY_INTERFACE: 'CGI/1.1'
SERVER_PORT: '9673'
SERVER_NAME: 'media10.ml.uwcm.ac.uk'
HTTP_CONNECTION: 'Keep-Alive'
HTTP_USER_AGENT: 'Mozilla/4.0 (compatible; MSIE 5.0b2; Windows NT)'
REMOTE_ADDR: '127.0.0.1'
HTTP_REFERER: =
'http://localhost:9673/servel/S_Compose_Mail?Domain_Name=3Dd032.ml.uwcm.a=
c.uk&login=3Dwmlyms'
, 'msg': ' we', 'file': <ZPublisher.Publish.FileUpload instance at =
964fc20>, 'fromme': 'ah@serveland.com', 'tolist': ['wmlyms']}, (None, =
None, None, None, None, '', None)))
TypeError: (see above)
-->
If you have managed to read everything, thanks for your patience...
P.S Many thanks for the help I were provided before
------=_NextPart_000_004B_01BE925F.FFFFDFA0
Content-type: text/html; charset="iso-8859-1"
Content-transfer-encoding: quoted-printable
<!DOCTYPE HTML PUBLIC "-//W3C//DTD W3 HTML//EN">
<HTML><HEAD>
<META content=3Dtext/html;charset=3Diso-8859-1 =
http-equiv=3DContent-Type>
<STYLE></STYLE>
<META content=3D'"MSHTML 5.00.0910.1309"' name=3DGENERATOR></HEAD>
<BODY bgColor=3D#ffffff>
<DIV><FONT face=3DArial size=3D2><STRONG>Hi =
everybody.</STRONG></FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=3DArial size=3D2><STRONG>I am meeting several problems =
about the=20
creation of the file attachment...</STRONG></FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=3DArial size=3D2><STRONG>Here is the Send_Mail dtml=20
document</STRONG></FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2><!--#var =
standard_html_header--></FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=3DArial size=3D2><!--#var file--></FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=3DArial size=3D2><!--#var=20
"Smtp_send_func(smtp_server=3DDomain_Name,tolist=3D[support],msg=3Db=
ody,subject=3Dsubject,fromme=3Dfromme,file=3Dfile,REQUEST=3DREQUEST)"=
;--><BR><br></FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=3DArial size=3D2><CENTER><H1>Message=20
Sent</H1><BR><br><BR><a=20
href=3D"S_Compose_Mail?Domain_Name=3D<!--#var=20
Domain_Name-->&login=3D<!--#var login-->"><IMG=20
SRC=3D"back" border=3D0></a></CENTER> =
</FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=3DArial size=3D2><!--#var =
standard_html_footer--></FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=3DArial size=3D2><STRONG>And here is the python smtp.py =
source=20
file:</STRONG></FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=3DArial size=3D2>def=20
smtp_send(self,smtp_server=3DNone,tolist=3DNone,msg=3DNone,subject=3DNone=
,fromme=3DNone,file=3D'',REQUEST=3DNone):<BR> =
smtp=3Dsmtplib.SMTP(smtp_server)<BR> msg=3D"Subject:=20
" + subject + "\n\r"=20
+msg<BR> smtp.sendmail(fromme,tolist,msg)<BR> smtp.quit()<BR> s=3D''<BR> =
<BR> s=3Ds+file.read()<BR>=20
return s</FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=3DArial size=3D2><STRONG>But it deosn't=20
work...</STRONG></FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=3DArial=20
size=3D2><HTML><HEAD><TITLE>yannick</TITLE></H=
EAD><BODY=20
BGCOLOR=3D"#FFFFFF"><BR><TABLE BORDER=3D"0"=20
WIDTH=3D"100%"><BR><TR><BR> <TD =
WIDTH=3D"10%"=20
ALIGN=3D"CENTER"><BR> <STRONG><FONT =
SIZE=3D"+6"=20
COLOR=3D"#77003B">!</FONT></STRONG><BR> =
</TD><BR> =20
<TD WIDTH=3D"90%"><BR><BR> <FONT=20
SIZE=3D"+2">System Unavailable</FONT><BR> =
<P>This site=20
is currently experiencing technical difficulties. <BR>Please contact the =
site=20
administrator for more information. For<BR>additional technical =
information,=20
please refer to the HTML source for this<BR>page. Thank you for your=20
patience.</P><BR> =20
</TD><BR></TR><BR></TABLE><BR><!--<BR> Error type: =
<BR>=20
Error value: read-only buffer, class<BR>=20
--><BR></BODY></HTML><BR><!--<BR>Traceback (innermost=20
last):<BR> File C:\Program =
Files\servel\lib\python\ZPublisher\Publish.py, line=20
877, in publish_module<BR> File C:\Program=20
Files\servel\lib\python\ZPublisher\Publish.py, line 590, in publish<BR> =
=20
(Info: /servel/Send_Mail)<BR> File C:\Program=20
Files\servel\lib\python\OFS\DTMLDocument.py, line 212, in __call__<BR> =
=20
(Object: Send_Mail)<BR> File C:\Program=20
Files\servel\lib\python\OFS\DTMLDocument.py, line 208, in __call__<BR> =
=20
(Object: Send_Mail)<BR> File C:\Program=20
Files\servel\lib\python\DocumentTemplate\DT_String.py, line 513, in =
__call__<BR>=20
(Object: Send_Mail)<BR> File C:\Program=20
Files\servel\lib\python\DocumentTemplate\DT_Util.py, line 266, in =
eval<BR> =20
(Object:=20
Smtp_send_func(smtp_server=3DDomain_Name,tolist=3D[support],msg=3Dbody,su=
bject=3Dsubject,fromme=3Dfromme,file=3Dfile,REQUEST=3DREQUEST))<BR>=20
File &lt;string&gt;, line 0, in ?<BR> File C:\Program=20
Files\servel\lib\python\Products\ExternalMethod\ExternalMethod.py, line =
254, in=20
__call__<BR> (Object: CopySource)<BR> (Info: ((), {'subject':=20
'&quot;Et maintenant admire la puissante de feu de ma =
STATION&quot;',=20
'smtp_server': 'd032.ml.ucwm.ac.uk', 'REQUEST': form:<BR> subject: =
'&quot;Et=20
maintenant admire la puissante de feu de ma STATION&quot;'<BR> =
Domain_Name:=20
'd032.ml.ucwm.ac.uk'<BR> support: 'wmlyms'<BR> file:=20
&lt;ZPublisher.Publish.FileUpload instance at 964fc20&gt;<BR> =
login:=20
'wmlyms'<BR> fromme: <A=20
href=3D"mailto:'ah@serveland.com'">'ah@serveland.com'</A><BR> body: ' =20
we'</FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=3DArial size=3D2><BR>environ:<BR> HTTP_ACCEPT_ENCODING: =
'gzip,=20
deflate'<BR> REMOTE_HOST: 'localhost'<BR> PATH_INFO:=20
'/servel/Send_Mail'<BR> CONTENT_LENGTH: '1217'<BR> SERVER_PROTOCOL:=20
'HTTP/1.0'<BR> CONTENT_TYPE: 'multipart/form-data;=20
boundary=3D---------------------------7cf3bda36301c0'<BR> =
PATH_TRANSLATED:=20
'C:\\NT\\Profiles\\wmlyms.000\\Desktop\\servel\\Send_Mail'<BR> =
HTTP_HOST:=20
'localhost:9673'<BR> REQUEST_METHOD: 'POST'<BR> HTTP_COOKIE:=20
'dtpref_rows=3D&quot;25&quot;; =
dtpref_cols=3D&quot;90&quot;;=20
tree-s=3D&quot;eJyLjjaMjQUABOIBog&quot;'<BR> SCRIPT_NAME:=20
''<BR> SERVER_SOFTWARE: 'ZopeHTTP/1.16 Python/1.5.1'<BR> =
HTTP_ACCEPT_LANGUAGE:=20
'en-us'<BR> HTTP_ACCEPT: 'image/gif, image/x-xbitmap, image/jpeg, =
image/pjpeg,=20
application/msword, application/vnd.ms-excel, =
application/vnd.ms-powerpoint,=20
*/*'<BR> GATEWAY_INTERFACE: 'CGI/1.1'<BR> SERVER_PORT: '9673'<BR> =
SERVER_NAME:=20
'media10.ml.uwcm.ac.uk'<BR> HTTP_CONNECTION: 'Keep-Alive'<BR> =
HTTP_USER_AGENT:=20
'Mozilla/4.0 (compatible; MSIE 5.0b2; Windows NT)'<BR> REMOTE_ADDR:=20
'127.0.0.1'<BR> HTTP_REFERER:=20
'http://localhost:9673/servel/S_Compose_Mail?Domain_Name=3Dd032.ml.uwcm.a=
c.uk&amp;login=3Dwmlyms'</FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=3DArial size=3D2><BR>, 'msg': ' we', 'file':=20
&lt;ZPublisher.Publish.FileUpload instance at 964fc20&gt;, =
'fromme': <A=20
href=3D"mailto:'ah@serveland.com'">'ah@serveland.com'</A>, 'tolist': =
['wmlyms']},=20
(None, None, None, None, None, '', None)))<BR>TypeError: (see=20
above)</FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=3DArial size=3D2>--></FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=3DArial size=3D2><STRONG>If you have managed to read =
everything,=20
thanks for your patience...</STRONG></FONT></DIV>
<DIV> </DIV>
<DIV> </DIV>
<DIV><FONT face=3DArial size=3D2><STRONG>P.S Many thanks for the help I =
were=20
provided before</STRONG></FONT></DIV></BODY></HTML>
------=_NextPart_000_004B_01BE925F.FFFFDFA0--