procmail
[Top] [All Lists]

Re: procmailrc filter through program mechanism

2007-05-28 11:59:41
On 5/28/07, Chirag Ravishankar <chiragrs(_at_)gmail(_dot_)com> wrote:
How does procmail "write" a mail into a program?

Procmail expects to receive the mail message on standard input.  When
running a filter, procmail expects to write the mesage to the filter's
standard input and to get the altered message back on the filter's
standard output.  No files are used [*] unless you explicitly redirect
to or from them.

[*] None used visibly to the programmer, that is.  Procmail uses
temporary files behind the scenes to avoid loss of data, but there is
no way to access them by name from procmailrc.

I have written a C++ code
that takes mail and extracts the attachments from it. I want to pass the
mail file as argument into this program.

If it is not possible to change your program to read from standard
input instead of from a named file, you'll have to do something like
this:

:0 c
/path/to/temporary/directory

:0 fw
| /path/to/program/extract $LASTFOLDER

Note that at the end of this step, the original message is gone and
has been replaced by the standard output of the extract program.  If
that's not what you intend, then you do not want to use a filter (the
"f" flag).

1. Receive email
2. Detach attachment (image)

What does "Receive email" mean, here?  If you mean the email has
already been delivered into a mailbox before step (2) begins, the
answer to your question is going to be very different than if the
entire process is supposed to take place as the message arrives
(before it has been placed in a mailbox).

3. Run the attachment through another C program, which modifies the image
and saves it in a specific folder.
4. Take the modified image and attach it to an email that goes back to the
sender.

So far, I have the receive email part, and I've been trying to use the:
formail -s
command to split the parts - (not working)

formail -s splits flat-file mailboxes into individual messages; it
does not split messages into their component parts, except for the
special case of mailing list "digests" where every part is itself a
message.

____________________________________________________________
procmail mailing list   Procmail homepage: http://www.procmail.org/
procmail(_at_)lists(_dot_)RWTH-Aachen(_dot_)DE
http://MailMan.RWTH-Aachen.DE/mailman/listinfo/procmail

<Prev in Thread] Current Thread [Next in Thread>