I'm running a filter for incoming email on Postfix that basically sends the email through SpamAssassin and then delivers it to the user by using dovecot-lda.

This is happening by editing Postfix's master.cf as follows:

smtp      inet  n       -       -       -       -       smtpd -o 

    spamassassin unix -     n   n   -   -   pipe
        flags=DROhu user=vmail:vmail argv=/usr/bin/spamc -f -e 
        /usr/lib/dovecot/deliver -f ${sender} -d ${user}@${nexthop} 

With this in mind, is there a way I can set a similar filter to outgoing email that will use dovecot-lda to place a copy of all sent email on the Sent folder?

I know that placing emails on the Sentfolder is usually work for the email client, however this causes bandwidth usage duplication since email clients have to sent the email over SMTP and then again over IMAP to the Sent folder... And I also have other specific reasons like PHP scripts sending email to want this.

The ideia is:

  • Email client sends email over SMTP
  • Outgoing email filter "catches" the email and uses dovecot-lda to deliver a copy to the Sentfolder (like I do on receiving);
  • Postfix does whatever next he needs to do (send the email to a remover server?).

Note: This should be compatible with mail submission on port 587, meaning it should first add all the headers and make sure the email is ok and then get filtered and deliver to Sent folder... etc.

Thank you.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.