Best way to automatically copy out attachments from an email
On 12Jan2011 14:16, email@example.com <firstname.lastname@example.org> wrote:
| Matty Sarro wrote:
| > As of now here is my situation:
| > I am working on a system to aggregate IT data and logs. A number of
| > important data are gathered by a third party system. The only
| > immediate way I have to access the data is to have their system
| > automatically email me updates in CSV format every hour. If I set up a
| > mail client on the server, this shouldn't be a huge issue.
| > However, is there a way to automatically open the emails, and copy the
| > attachments to a directory based on the filename? Kind of a weird
| > project, I know. Just looking for some ideas hence posting this on two
| > lists.
| Well, they are presumably in std. MIME format, so you can strip it off,
| maybe with a filter either in your mail tool, or in the delivery system.
| procmail comes to mind.
1: Install metamail.
2: Try this script:
The particular metamail command you want is "metamail -w -x"; see the
man page for details.
The mailunpack script above just does a lot of the housekeeping and
automation you will doubtless want to do anyway; it does need a bunch of my
other scripts, see:
to get the lot, typically installing them in /opt/css for easy use.
Then all you need to do is use procmail to filter you email, and have it
pass the relevant emails to mailunpack with the right arguments (or of
course directly to "metamail -w -x" with some wrapping).
Anyway, you're welcome to the script for use or for inspection.
Cameron Simpson <email@example.com> DoD#743
If you push something hard enough, it will fall over.
[Fudd's first law of opposition]
redhat-list mailing list