Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Using procmail forward emails to another account keeping a copy

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"
like image 774
erno666 Avatar asked May 09 '12 12:05

erno666


People also ask

What is procmail forwarding?

Forwarding of e-mails using Procmail Procmail allows us to set up the same email forwarding as the file . forward , that is, preserving the sender's envelope address. See below for an example of the settings. Note: There are always two whitespace characters in these square brackets: a space and a tab.

How does Procmail work?

Procmail is a program for filtering, sorting and storing email. It can be used both on mail clients and mail servers. It can be used to filter out spam, checking for viruses, to send automatic replies, etc. The goal of this article is to teach the configuration of procmail.


1 Answers

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
like image 120
erno666 Avatar answered Dec 05 '22 00:12

erno666