-1

I need to forward all the incoming mails on a linux system to the folder /home/INBOX. How can I make the mbox of incoming msgs be created in this folder which automatically gets all the mails forwarded here? I am using the following code that is not working.

    :0
    ! /home/INBOX

Even after writing this in procmailrc the mails are still present in the default spool folder and not getting saved in the specified folder.

tripleee
  • 139,311
  • 24
  • 207
  • 268
Aditya Raman
  • 167
  • 6
  • 18

1 Answers1

0

! is for forwarding email and /home/INBOX is not a valid email address.

Examining your procmail.log should easily reveal this.

Maybe you are confused by your own terminology. To "forward" a message is to continue to relay it to a different server and/or account, whereas saving to a file is called "delivering".

You probably mean

:0:
/home/INBOX

with locking (the second colon), because mbox folders require mutual exclusion (otherwise you might get one delivery process writing a message smack dab in the middle of a message being written by another delivery process, thereby wrecking the integrity of the mbox file).

You could also simply set DEFAULT=/home/INBOX as then Procmail will deliver there when it runs out of other things to try.

On a high-volume system, the locking might lead to congestion, in which case switching to a more resilient mailbox format might be a good choice; maildir is pretty much the de facto standard these days. A maildir is slightly more awkward to work with than a single mbox file, but it has other useful properties (and if you pull messages out of the maildir, you are of course free to then convert them to mbox for convenience).

For what it's worth, /home/INBOX is an extremely nonstandard location. The entries in /home should be the home directories of individual users, and only root should have write access to this directory (whereas of course users should have full access to the individual subdirectories which are their respective home directories). But if that's what you really want, and you have arranged for yourself to have write access there, it's not immediately broken, just weird.

tripleee
  • 139,311
  • 24
  • 207
  • 268