libgmail: attaching files

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • wal

    #1

    libgmail: attaching files

    How does one attach files to emails using libgmail? The following code

    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:\Documen ts and
    Settings\lucp17 35\Desktop\libg mail-0.1.5.1\knujon. py", line 24, in <module>
    if ga.sendMessage( fs):
    File "C:\Documen ts and
    Settings\lucp17 35\Desktop\libg mail-0.1.5.1\libgmai l.py", line 582, in
    sendMessage
    msgStr = mimeMessage.as_ string()
    File "C:\program files\Python25\ lib\email\messa ge.py", line 131, in
    as_string
    g.flatten(self, unixfrom=unixfr om)
    File "C:\program files\Python25\ lib\email\gener ator.py", line 84, in
    flatten
    self._write(msg )
    File "C:\program files\Python25\ lib\email\gener ator.py", line 109, in
    _write
    self._dispatch( msg)
    File "C:\program files\Python25\ lib\email\gener ator.py", line 135, in
    _dispatch
    meth(msg)
    File "C:\program files\Python25\ lib\email\gener ator.py", line 201, in
    _handle_multipa rt
    g.flatten(part, unixfrom=False)
    File "C:\program files\Python25\ lib\email\gener ator.py", line 84, in
    flatten
    self._write(msg )
    File "C:\program files\Python25\ lib\email\gener ator.py", line 109, in
    _write
    self._dispatch( msg)
    File "C:\program files\Python25\ lib\email\gener ator.py", line 135, in
    _dispatch
    meth(msg)
    File "C:\program files\Python25\ lib\email\gener ator.py", line 266, in
    _handle_message
    g.flatten(msg.g et_payload(0), unixfrom=False)
    File "C:\program files\Python25\ lib\email\messa ge.py", line 185, in
    get_payload
    raise TypeError('Expe cted list, got %s' % type(self._payl oad))
    TypeError: Expected list, got <type 'str'>


Working...