Constructing MIME message without loading message stream

Discussion in 'Python' started by Kris Kennaway, Aug 9, 2008.

  1. I would like to MIME encode a message from a large file without first
    loading the file into memory. Assume the file has been pre-encoded on
    disk (actually I am using encode_7or8bit, so the encoding should be
    null). Is there a way to construct the flattened MIME message such that
    data is streamed from the file as needed instead of being resident in
    memory? Do I have to subclass the MIMEBase class myself?

    Kris
     
    Kris Kennaway, Aug 9, 2008
    #1
    1. Advertising

  2. Kris Kennaway schrieb:
    > I would like to MIME encode a message from a large file without first
    > loading the file into memory. Assume the file has been pre-encoded on
    > disk (actually I am using encode_7or8bit, so the encoding should be
    > null). Is there a way to construct the flattened MIME message such that
    > data is streamed from the file as needed instead of being resident in
    > memory? Do I have to subclass the MIMEBase class myself?


    I don't know what you are after here - but I *do* know that anything
    above 10MB or so is most probably not transferable using mail, as MTAs
    impose limits on message-sizes. Or in other words: usually, whatever you
    want to encode should fit in memory as the network is limiting you.

    If you insist, I guess the stdlib isn't much of help - try implementing
    a SMTP-server using twisted. But this is just a guess.

    Diez
     
    Diez B. Roggisch, Aug 10, 2008
    #2
    1. Advertising

  3. Diez B. Roggisch wrote:
    > Kris Kennaway schrieb:
    >> I would like to MIME encode a message from a large file without first
    >> loading the file into memory. Assume the file has been pre-encoded on
    >> disk (actually I am using encode_7or8bit, so the encoding should be
    >> null). Is there a way to construct the flattened MIME message such
    >> that data is streamed from the file as needed instead of being
    >> resident in memory? Do I have to subclass the MIMEBase class myself?

    >
    > I don't know what you are after here - but I *do* know that anything
    > above 10MB or so is most probably not transferable using mail, as MTAs
    > impose limits on message-sizes. Or in other words: usually, whatever you
    > want to encode should fit in memory as the network is limiting you.


    MIME encoding is used for other things than emails.

    Kris
     
    Kris Kennaway, Aug 11, 2008
    #3
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. CJ
    Replies:
    1
    Views:
    1,603
    Andrew Thompson
    Oct 29, 2004
  2. Replies:
    1
    Views:
    335
    Alf P. Steinbach
    Feb 23, 2006
  3. Jan Arickx
    Replies:
    0
    Views:
    216
    Jan Arickx
    Aug 25, 2003
  4. joe
    Replies:
    0
    Views:
    213
  5. ecureuil
    Replies:
    0
    Views:
    357
    ecureuil
    May 28, 2006
Loading...

Share This Page