Sending mail with attachment...
Merrigan
charl.loubser at gmail.com
Sat May 13 06:13:33 EDT 2006
Hi Guys,
I just wanted to post the error, and then also the coda that causes
it....I get this no matter what I do to this, and I don't understand
it. Any help would be welcome. Thank you
Error
::
Traceback (most recent call last):
File "/home/merrigan/projects/Backup Script/hobbitarchive.py", line
113, in ?
mailSender()
File "/home/merrigan/projects/Backup Script/hobbitarchive.py", line
74, in mailSender
s.sendmail(fromaddy, recievelist, mesg.as_string())
File "/usr/lib/python2.4/email/Message.py", line 129, in as_string
g.flatten(self, unixfrom=unixfrom)
File "/usr/lib/python2.4/email/Generator.py", line 82, in flatten
self._write(msg)
File "/usr/lib/python2.4/email/Generator.py", line 120, in _write
self._write_headers(msg)
File "/usr/lib/python2.4/email/Generator.py", line 166, in
_write_headers
header_name=h, continuation_ws='\t').encode()
File "/usr/lib/python2.4/email/Header.py", line 395, in encode
return self._encode_chunks(newchunks, maxlinelen)
File "/usr/lib/python2.4/email/Header.py", line 355, in
_encode_chunks
_max_append(chunks, s, maxlinelen, extra)
File "/usr/lib/python2.4/email/quopriMIME.py", line 79, in
_max_append
L.append(s.lstrip())
AttributeError: 'list' object has no attribute 'lstrip'
::
Code
::
def mailSender():
openlogmsg = open(completelog, 'rb')
mesg = MIMEText(openlogmsg.read())
openlogmsg.close()
mesg['Subject'] = subject
mesg['From'] = fromaddy
mesg['To'] = recievelist
s = smtplib.SMTP(smtpserver)
# s.connect(smtpserver)
s.sendmail(fromaddy, recievelist, mesg.as_string())
s.quit()
::
Thanks a lot :)
More information about the Python-list
mailing list