homepage Welcome to WebmasterWorld Guest from 54.205.241.107
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Pubcon Platinum Sponsor 2014
Home / Forums Index / Hardware and OS Related Technologies / Linux, Unix, and *nix like Operating Systems
Forum Library, Charter, Moderators: bakedjake

Linux, Unix, and *nix like Operating Systems Forum

    
Save MIME email attachment to disk
Seeking solution to receive e-mail, strip the attached file, and save.
venice

5+ Year Member



 
Msg#: 4297691 posted 5:19 pm on Apr 14, 2011 (gmt 0)

Hopefully this is the right place for this thread, I've been searching for a solution to save attached image files sent by email, onto a linux server.

The reasoning behind this is as I'm getting older I'm finding I take photos for blog posts and forgotten I've done so. I want to take the photo > name it > email it > save it on the server so writers have it available for posts.

The Goal: Save MIME single email attachments to disk

Would apply to a specific email address intended for this purpose.

I send email with image attached and email received on server.

Attachment is removed from email and saved to a directory.

Example: Attached file img0001.jpg saved as... /home/public_html/images/img0001.jpg

OR if Possible

Attachment is removed from email and saved to a directory using email subject line as filename.

Example: Attached file img0001.jpg saved as red-widget.jpg in... /home/public_html/images

If file name already exists, new file gets appended -01.jpg or other.

Email gets deleted.

In searching WebmasterWorld and elsewhere, I've come across things like metamail, ripMIME and a PERL script, and I figure a script has to be written or modified to make it all happen.

Any tips on how best to accomplish this are appreciated.

 

mbabuskov



 
Msg#: 4297691 posted 5:28 pm on Apr 14, 2011 (gmt 0)

You need to provide more information, for example where do you want e-mail to be extracted from? Is it POP3, IMAP server or local file or database storage?

venice

5+ Year Member



 
Msg#: 4297691 posted 5:40 pm on Apr 14, 2011 (gmt 0)

Thanks for the reply. I believe it would be extracted from a local file. Right now mail goes to user directory in mail folder on domain.

Hoople

10+ Year Member



 
Msg#: 4297691 posted 12:56 am on Apr 15, 2011 (gmt 0)

Eudora and other email clients will do this. Some are scriptable after setting behavior in their GUI.

graeme_p

WebmasterWorld Senior Member 5+ Year Member



 
Msg#: 4297691 posted 7:58 pm on Apr 15, 2011 (gmt 0)

If its just a matter of parsing local email and extracting the attachments, you can probably do this with any of the major scripting languages. It looks to me like the email package in the Python standard library can do it for a start. Write a script, call it with a cron job.

You may be able to do it using the nmh command line email tools. I am not familiar with them, but the functionality to extract attachments exists.

dstiles

WebmasterWorld Senior Member dstiles us a WebmasterWorld Top Contributor of All Time 5+ Year Member



 
Msg#: 4297691 posted 10:35 pm on Apr 15, 2011 (gmt 0)

Thunderbird can save the complete email (as a .eml file - just press Ctrl-S) or you can save individual or all attachments from an email to wherever you like.

venice

5+ Year Member



 
Msg#: 4297691 posted 11:28 pm on Apr 15, 2011 (gmt 0)

Thanks everyone. Had a script written in php, working out the bugs now, hopefully up by tomorrow.

Global Options:
 top home search open messages active posts  
 

Home / Forums Index / Hardware and OS Related Technologies / Linux, Unix, and *nix like Operating Systems
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved