libgmail: attaching files

W

wal

How does one attach files to emails using libgmail? The following code
http://pramode.net/articles/lfy/fuse/4.txt
works fine when said files are simple text files, but it failes as soon as
the files are wild binary files, even attaching the source of an email in a
text file (.eml files) failes.
What am I missing here? Any hints?
The output I get when attemting to send binary files using the code above
is pasted below.

have fun,
wal

----------------------------------
Traceback (most recent call last):
File "C:\Documents and
Settings\lucp1735\Desktop\libgmail-0.1.5.1\knujon.py", line 24, in <module>
if ga.sendMessage(fs):
File "C:\Documents and
Settings\lucp1735\Desktop\libgmail-0.1.5.1\libgmail.py", line 582, in
sendMessage
msgStr = mimeMessage.as_string()
File "C:\program files\Python25\lib\email\message.py", line 131, in
as_string
g.flatten(self, unixfrom=unixfrom)
File "C:\program files\Python25\lib\email\generator.py", line 84, in
flatten
self._write(msg)
File "C:\program files\Python25\lib\email\generator.py", line 109, in
_write
self._dispatch(msg)
File "C:\program files\Python25\lib\email\generator.py", line 135, in
_dispatch
meth(msg)
File "C:\program files\Python25\lib\email\generator.py", line 201, in
_handle_multipart
g.flatten(part, unixfrom=False)
File "C:\program files\Python25\lib\email\generator.py", line 84, in
flatten
self._write(msg)
File "C:\program files\Python25\lib\email\generator.py", line 109, in
_write
self._dispatch(msg)
File "C:\program files\Python25\lib\email\generator.py", line 135, in
_dispatch
meth(msg)
File "C:\program files\Python25\lib\email\generator.py", line 266, in
_handle_message
g.flatten(msg.get_payload(0), unixfrom=False)
File "C:\program files\Python25\lib\email\message.py", line 185, in
get_payload
raise TypeError('Expected list, got %s' % type(self._payload))
TypeError: Expected list, got <type 'str'>
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,744
Messages
2,569,482
Members
44,901
Latest member
Noble71S45

Latest Threads

Top