|
From: Martin Gregorie on 20 Oct 2006 11:13 I've run into something that the manuals don't cover adequately. Here's the situation. I'm currently using Postfix with a "bcc_all" directive to send an archival stream of emails to a dedicated mail archive used. As a stopgap these are intercepted by a .forward file that feeds them into procmail. The procmail recipe appends them to an mbox format file which is selected depending on the e-mail's date. The next step is the use a JavaMail-based e-mail storage program to index the e-mails and store them in a postgres DB in order to make searching and retrieval fast and painless. I'd like the use the .forward mechanism to start the e-mail storage program in an analogous way to what it's doing with procmail, but the e-mail storage program will access the archival mailbox via POP3 rather than having the e-mail(s) piped into it like procmail. The Postscript manual says in one place that the .forward file can contain any command or combination of commands and refers to the sendmail documentation for further information, *but* in its detailed description of .forward it only mentions the piped "| command" with no hint that unpiped commands can be used. The online sendmail documentation doesn't even mention putting commands in the .forward file. My questions: - has anybody tried using .forward to run unpiped commands on receipt of mail from Postfix? - what happened to the e-mails? Did they just stay in the Postfix mailbox awaiting collection? -- martin@ | Martin Gregorie gregorie. | Essex, UK org |
From: Chris F.A. Johnson on 20 Oct 2006 16:24 On 2006-10-20, Martin Gregorie wrote: > I've run into something that the manuals don't cover adequately. > > Here's the situation. I'm currently using Postfix with a "bcc_all" > directive to send an archival stream of emails to a dedicated mail > archive used. As a stopgap these are intercepted by a .forward file that > feeds them into procmail. The procmail recipe appends them to an mbox > format file which is selected depending on the e-mail's date. > > The next step is the use a JavaMail-based e-mail storage program to > index the e-mails and store them in a postgres DB in order to make > searching and retrieval fast and painless. > > I'd like the use the .forward mechanism to start the e-mail storage > program in an analogous way to what it's doing with procmail, but the > e-mail storage program will access the archival mailbox via POP3 rather > than having the e-mail(s) piped into it like procmail. > > The Postscript manual says in one place that the .forward file can > contain any command or combination of commands and refers to the > sendmail documentation for further information, *but* in its detailed > description of .forward it only mentions the piped "| command" with no > hint that unpiped commands can be used. The online sendmail > documentation doesn't even mention putting commands in the .forward file. > > My questions: > > - has anybody tried using .forward to run unpiped commands on > receipt of mail from Postfix? How do you expect to use an unpiped command? How do you expect it to get the e-mail? You have to write a wrapper script that reads the mail and stores it in a file so that you can give that as an argument to an unpiped command. -- Chris F.A. Johnson <http://cfaj.freeshell.org> =================================================================== Author: Shell Scripting Recipes: A Problem-Solution Approach (2005, Apress)
From: Martin Gregorie on 21 Oct 2006 14:19 Chris F.A. Johnson wrote: > On 2006-10-20, Martin Gregorie wrote: >> >> - has anybody tried using .forward to run unpiped commands on >> receipt of mail from Postfix? > > How do you expect to use an unpiped command? How do you expect it > to get the e-mail? > Sorry - should have said. I was hoping to use .forward to launch a JavaMail based program that would use POP3 via Dovecot to get the mail. I already have Dovecot installed so that would be less resource intensive than a program started by cron or a daemon that polls for mail because it only gets started when mail is received. > You have to write a wrapper script that reads the mail and stores > it in a file so that you can give that as an argument to an unpiped > command. > If I have to do that it would probably be easier to create a transport protocol class that can accept the piped-in message. The POP3 protocol comes as part of the JavaMail package and I'm lazy.... -- martin@ | Martin Gregorie gregorie. | Essex, UK org |
From: Chris F.A. Johnson on 21 Oct 2006 20:49 On 2006-10-21, Martin Gregorie wrote: > Chris F.A. Johnson wrote: >> On 2006-10-20, Martin Gregorie wrote: >>> >>> - has anybody tried using .forward to run unpiped commands on >>> receipt of mail from Postfix? >> >> How do you expect to use an unpiped command? How do you expect it >> to get the e-mail? >> > Sorry - should have said. I was hoping to use .forward to launch a > JavaMail based program that would use POP3 via Dovecot to get the mail. Then why are you using a .forward file? If the .forward is used, the mail is already retrieved from the POP3 server. > I already have Dovecot installed so that would be less resource > intensive than a program started by cron or a daemon that polls for mail > because it only gets started when mail is received. How are you receiving your mail? >> You have to write a wrapper script that reads the mail and stores >> it in a file so that you can give that as an argument to an unpiped >> command. >> > If I have to do that it would probably be easier to create a transport > protocol class that can accept the piped-in message. > > The POP3 protocol comes as part of the JavaMail package and I'm lazy.... Do you mean a POP3 client comes...? -- Chris F.A. Johnson <http://cfaj.freeshell.org> =================================================================== Author: Shell Scripting Recipes: A Problem-Solution Approach (2005, Apress)
From: Martin Gregorie on 22 Oct 2006 08:05 Chris F.A. Johnson wrote: > On 2006-10-21, Martin Gregorie wrote: >> Chris F.A. Johnson wrote: >>> On 2006-10-20, Martin Gregorie wrote: >>>> - has anybody tried using .forward to run unpiped commands on >>>> receipt of mail from Postfix? >>> How do you expect to use an unpiped command? How do you expect it >>> to get the e-mail? >>> >> Sorry - should have said. I was hoping to use .forward to launch a >> JavaMail based program that would use POP3 via Dovecot to get the mail. > > Then why are you using a .forward file? If the .forward is used, > the mail is already retrieved from the POP3 server. > ....because I don't know what fires the .forward file. I was hoping to use the same mechanism to trigger my application. >> I already have Dovecot installed so that would be less resource >> intensive than a program started by cron or a daemon that polls for mail >> because it only gets started when mail is received. > > How are you receiving your mail? > fetchmail -> Postfix -> Dovecot -> Evolution | ------> procmail -> mbox (mail archiving system) >>> You have to write a wrapper script that reads the mail and stores >>> it in a file so that you can give that as an argument to an unpiped >>> command. >>> >> If I have to do that it would probably be easier to create a transport >> protocol class that can accept the piped-in message. >> >> The POP3 protocol comes as part of the JavaMail package and I'm lazy.... > > Do you mean a POP3 client comes...? > The package includes a pop3 client Thanks for the information. That tells me what I wanted to know. It looks like my best bet is either to (a) run the application as a daemon using POP3 to periodically poll for mail or (b) to write a pipe interface for JavaMail and use .forward to run it. Currently I'm leaning toward (a). -- martin@ | Martin Gregorie gregorie. | Essex, UK org |
|
Next
|
Last
Pages: 1 2 Prev: DAT backups - do I need to erase the tape? Next: Linux equivelent of setenv DISPLAY ? |