"Joe Cheong" wrote:
Thanks again for the guide. Do you have any idea how I can find out the
attached files' name and use that as an input to my program?
The original script puts the filename into the mail header as
"X-munpack-info: /path/to/the/file" -- that's what this part is for:
FARGS=`sed '/^Content-[Tt]ype:.*[Nn]ame=/s,[Tt]ext/,application/,' | \
munpack -C $TMPDIR 2>&1 | \
grep -v -e "reading from standard input" -e '^$SPC$' | \
sed -e "s,^,-A 'X-munpack-info: $TMPDIR/," -e "s/$/'/"`
You can get the file names in a variety of ways -- e.g., after the
"formail" is done, you can say
FNAMES=`formail -zxx-munpack-info:`
As the number of files may vary, also to support for concurrent access,
is there a way to generate random number thru shell command such that we can
define:
RANDNUM=`xxxxxx`
TMPDIR=/tmp/$RANDNUM
I don't know about that. The LOCKFILE will keep instances from
clobbering each other. That, plus munpack()'s duplicate-prevention
logic, should keep things OK for you. From the munpack(1) manpage:
... If a message
suggests a file name of an existing file, the file
will be overwritten. Without this flag, munpack
appends ".1", ".2", etc to find a nonexistent file.
cheers,
--
Neither I nor my employer will accept any liability for any problems
or consequential loss caused by relying on this information.
Collin Park Not a statement of my employer.
_______________________________________________
procmail mailing list
procmail(_at_)lists(_dot_)RWTH-Aachen(_dot_)DE
http://MailMan.RWTH-Aachen.DE/mailman/listinfo/procmail