8

I try to use procmail to send copies from all incoming emails to another email account (both of them on the same server, for example email1 and email2 accounts).

My .procmailrc is in email1 account:

:0c
! email2

As fas as I know this should keep a copy in email1 account too. But there is no email in that folder. (The forwarded emails appeared in email2 account correctly.)

How can I solve this problem?

Note: .forward file contains:

| "/usr/bin/procmail"
tripleee
  • 139,311
  • 24
  • 207
  • 268
erno666
  • 163
  • 1
  • 1
  • 9
  • 1
    If that's your entire `.procmailrc` then something in the delivery process is broken. If not, something later on in your `.procmailrc` is routing the message to a folder you have not been looking at. Try running with `LOGABSTRACT=yes` and/or `VERBOSE=yes`. See furthermore http://partmaps.org/era/mail/procmail-debug.html – tripleee May 10 '12 at 06:39
  • Thank you, for you help. – erno666 May 10 '12 at 14:51
  • Thank you, for you help. It was useful. Yes, it is the full .procmailrc file. (Naturally I intend to create a complex procmailrc file in the future.) I set logabstract=yes and verbose=yes and a logfile. I see in the log file, that the emails of email1 is delivered to /var/mail/email1. I dont understand why. I tried to set MAILDIR=$HOME or MAILRDIR=/home/email1 or MAILDIR=/home/email1/Maildir but no success. Note: If I remove .forward and .procmailrc files, emails arrive to /home/email1 correctly. – erno666 May 10 '12 at 15:01
  • 1
    What are the values of `$DEFAULT`, `$ORGMAIL`, etc? There's a bunch of these, have a look at http://partmaps.org/era/procmail/mini-faq.html and/or the procmailrc(5) manual page. – tripleee May 10 '12 at 15:58
  • Thank you very much, you pointed the right direction, see my edited question. – erno666 May 11 '12 at 09:25

1 Answers1

5

This works for me (many thanks to tripleee):
First, I had to set the DEFAULT variable too. (Its default is $ORGMAIL, and ORGMAIL default is /var/mail/$LOGNAME, as described in procmailrc manual Environment variable defaults section.)
Second, I had to set trailing / to the DEFAULT and MAILDIR. (If there is no trailing /, procmail use mbox format and it creates an mbox file like msg.oqs in the specified directory.)

So the full .procmailrc:

DEFAULT=$HOME/Maildir/
MAILDIR=$HOME/Maildir/

:0c
! email2

If you would like to debug, write these rows after MAILDIR:

LOGFILE=$HOME/procmail.log
LOGABSTRACT=yes
VERBOSE=yes
erno666
  • 163
  • 1
  • 1
  • 9