Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I use procmail to handle some serverside mail processing. I am trying to setup one email address on a server that support multiple domains (in the example below, domain.net and domain.com). I want mail sent to user@domain.net to go to bob and mail sent to user@domain.com to go to sara.

VERBOSE=off
LOGFILE=/dev/null

:0
* .domain.net
bob

:0
* .domain.com
sara

The above recipe seems to work quite well in that it catches incoming mail to domain.net and forwards it to bob.

However, instead of forwarding mail to domain.com to sara, it creates a file in /home/user called sara.

What am I doing wrong on this?

share|improve this question
    
The fundamental problem is "don't do that". See partmaps.org/era/procmail/mini-faq.html#bcc-explanation –  tripleee Oct 19 '11 at 12:13
    
and the downvote is for ...? –  warren Jun 19 '13 at 17:37
add comment

1 Answer

up vote 2 down vote accepted

You're delivering to a local file, not forwarding the message on to users. Also (as you pointed out in your comment) you aren't carbon-copying the message, so delivery stops after the first matching rule.

# 'c'opy the message to deliver it twice.
# ! to forward the message
:0 c
* .domain.net
! bob

:0
* .domain.com
! sara

The prcomailrc manpage says:

Anything else will be taken as a mailbox name (either a filename or a directory, absolute or relative to the current directory (see MAILDIR)). If it is a (possibly yet nonexistent) filename, the mail will be appended to it.

The best way to debug procmail issues is to set verbose and logfile in your .procmailrc. Examining the logfile will go a long way toward revealing why procmail is acting a particular way.

EDIT: Updated with carbon-copy info based on OP comment.

share|improve this answer
    
Yes, without the bang (!) symbol, the recipe says to deliver to local file. –  Robert Novak Mar 7 '11 at 22:11
2  
Also, you might want to use something like ^TOdomain.net to be more precise in your targeting. The recipes as listed (I think) will match any header containing .domain.net or .domain.com, including the subject. –  Robert Novak Mar 7 '11 at 22:12
    
thanks! the other component I need is a ` c` after the :0, so it not looks like :0 c. –  warren Mar 7 '11 at 22:23
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.