0

can we processing incoming email based on subject and save those matching email details in db and flag/tag the email in courierimapkeywords/:list for the keyword to be used in IMAP client. We need further processing of those emails marked/saved in db by a java application.

Would anybody give me some hint or examples on how to do this. The postfix+courier server is running on Ubuntu.

1 Answers1

0

You should look at the postfix milter documentation, as this will basically be a case of postfix passing the mail to the milter, the milter doing what you desire, then the milter will re-inject the mail back into postfix. Normally this is done to run checks on the mail, for things like DKIM or altering the mail or attachments, but there's no reason it couldn't be used in the manner you desire.

NickW
  • 10,263
  • 1
  • 20
  • 27
  • is it possible after mail is delivered to mailbox [from postfix overview its local(8)]? Its been configured to **virtual_transport = virtual** and not using maildrop or procmail – postfix_user Feb 18 '14 at 09:41
  • The virtual transport is the last stop, anything like a milter will be run before the delivery.. if you want to run it during or after the local delivery, something like sieve or local procmail recipes might be a better choice. – NickW Feb 18 '14 at 10:25
  • can we plugin a script to postfix mail delivery agent [virtual(8)](http://www.postfix.org/virtual.8.html), without installing sieve/procmail/maildrop ? – postfix_user Feb 19 '14 at 05:19
  • Of course you can, you just need to create the service, and the script, then ensure that postfix is ready to receive the mail back from your script. All of this is described quite well in the milter documentation. – NickW Feb 19 '14 at 09:14
  • with maildrop/procmail/dovecot we just need to pipe it `maildrop unix - n n - - pipe flags=DRhu user=vmail argv=/usr/bin/maildrop -d ${recipient}` and specify it in main.cf file `virtual_transport = maildrop/dovecot/procmail` and we can have wrapper script arround this and handle actual delivery to these LDA inside the script. in case of **virtual_transport = virtual** we will not have pipe to pass the data how to have wrapper script in case of postfix virtual local mail deliver ? – postfix_user Feb 19 '14 at 09:39
  • I understand why you're concerned about the virtual service, as you want this to be the last step before mail delivery, if you think that virtual is the right place, create a new transport in master.cf, where you do everything you need (db, deliver to mailbox) and use it as the `virtual_transport` . – NickW Feb 19 '14 at 09:59