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=Domain_Name,tolist=[support],msg=body,subject=subject,fromme=fromme,file=file,REQUEST=REQUEST)"-->
<br>
<CENTER><H1>Message
Sent</H1>
<br>
<a
href="S_Compose_Mail?Domain_Name=<!--#var
Domain_Name-->&login=<!--#var login-->"><IMG
SRC="back" border=0></a></CENTER>
<!--#var standard_html_footer-->
And here is the python smtp.py source
file:
def
smtp_send(self,smtp_server=None,tolist=None,msg=None,subject=None,fromme=None,file='',REQUEST=None):
smtp=smtplib.SMTP(smtp_server)
msg="Subject:
" + subject + "\n\r"
+msg
smtp.sendmail(fromme,tolist,msg)
smtp.quit()
s=''
s=s+file.read()
return s
But it deosn't
work...
<HTML><HEAD><TITLE>yannick</TITLE></HEAD><BODY
BGCOLOR="#FFFFFF">
<TABLE BORDER="0"
WIDTH="100%">
<TR>
<TD WIDTH="10%"
ALIGN="CENTER">
<STRONG><FONT SIZE="+6"
COLOR="#77003B">!</FONT></STRONG>
</TD>
<TD WIDTH="90%"><BR>
<FONT
SIZE="+2">System Unavailable</FONT>
<P>This site
is currently experiencing technical difficulties.
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:
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=Domain_Name,tolist=[support],msg=body,subject=subject,fromme=fromme,file=file,REQUEST=REQUEST))
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=---------------------------7cf3bda36301c0'
PATH_TRANSLATED:
'C:\\NT\\Profiles\\wmlyms.000\\Desktop\\servel\\Send_Mail'
HTTP_HOST:
'localhost:9673'
REQUEST_METHOD: 'POST'
HTTP_COOKIE:
'dtpref_rows="25"; dtpref_cols="90";
tree-s="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=d032.ml.uwcm.ac.uk&login=wmlyms'
, '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