Pruning e-mail attachments.
    Kevin D. Clark 
    kclark at mtghouse.com
       
    Fri Mar 31 18:07:00 EST 2006
    
    
  
Ken D'Ambrosio writes:
> Hello, all -- first and foremost, I'm pleased to announce the birth of
> Isabella Francesca D'Ambrosio -- for those with places in their hearts
> for baby pics, have at: http://flyingtoasters.net/gallery/album26?page=4
> .  Now that the birth done with, I hope to be able to make impending
> meetings again (what with all my new-found spare time </sarcasm>).
[congratulations email sent seperately  (-: ]
> And now for the actual on-topic stuff: I've got a Blackberry user who
> gets inbound e-mail bounced from time to time because of large
> attachments.  Since I route all his e-mail both to his IMAP account and
> the Blackberry, there's no reason I couldn't strip off the attachments
> -- *IF* I knew what it was that designated the start of an attachment. 
> Upon looking at the raw text of a message, I remain somewhat ignorant. 
> While I'm somewhat tempted to delve into the RFC's, if there's a
> quick-n-dirty way to find out where to start stripping off text, I'd
> appreciate being told about it.
Download the Perl MIME::Tools library.
Look in the examples directory.  There's a little program here called
"mimeexplode".
Run the specified email through mimeexplode.  If any of the
attachments that are dumped out are >N, where N is the max size of
messages that don't get bounced, then cobble together a new message
from the smaller attachments and send this instead, adding a note to
the effect of "attachments deleted here".
Forward the message along to the Blackberry and delete the cruft left
over by MIME::Tools.
There's no reason to write your own MIME parser.  This is quick and
dirty and it will work well.
Hope this helps,
--kevin
-- 
GnuPG ID: B280F24E                     And the madness of the crowd
alumni.unh.edu!kdc                     Is an epileptic fit
                                       -- Tom Waits
    
    
More information about the gnhlug-discuss
mailing list