Click to See Complete Forum and Search --> : procmail


MarkLeong
10-07-2001, 10:57 PM
How do I set up procmail so that mail recieved by A is delivered to A, B and C?

klamath
10-08-2001, 12:35 AM
Why not use a .forward file, or /etc/aliases?

But of course, you can do it with procmail also, I just can't remember how off the top of my head.

MarkLeong
10-08-2001, 08:34 PM
Can anybody else help me on this? An example of the procmailrc file would be appreciated.

leslie
10-10-2001, 01:57 AM
Are you talking about sending mail to like...

all a* mail goes to...

/var/spool/mail/a/

all b* mail goes to..

/var/spool/mail/b/


Or are you wanting the mail from user A to automatically goto user B.

MarkLeong
10-10-2001, 05:21 AM
Thanks Leslie.

I want mails going to user A to automatically go to B and C.

leslie
10-10-2001, 11:48 AM
Originally posted by MarkLeong:
Thanks Leslie.

I want mails going to user A to automatically go to B and C.

You don't even hve to use procmail. You can can just do simple aliases. Here's what you do....


#Open aliases file
1. Open /etc/mail/aliases in a text editor


#Add the following line to the alias file.
#This will send all mail going to a... to b
#and c. Just fill in a b and c with the
#proper usernames.
2. a: b,c

3. Save the file and run "newaliases" at the command prompt.


If you have any problems with that... let me know and I can take a look at what exactly should be done with procmail to forward the mail.

MarkLeong
10-10-2001, 07:54 PM
Thanks. Will revert on Monday.

klamath
10-10-2001, 10:19 PM
You don't even hve to use procmail. You can can just do simple aliases

Which is exactly what I said.

MarkLeong
10-14-2001, 11:21 PM
Thanks for the advices however I think alias is not what I really wanted. May I need to be clearer about my problem definition. Here goes....

I have 3 users:-

A@someserver.com
B@someserver.com
C@someserver.com

When A@someserver.com receives a mail, I want one copy of the mail to be forwarded to B@someserver.com and also c@someserver.com. With this, A, B and C would all have a copy of the mail.

I managed to script .procmailrc so that at least B or C will receive a the mail but not A, B and C at the same time.

Additionally, how to make sure that A and B got a copy of the mail if somebody send the mail to:

A <B@someserver.com>

Thanks once again in advance for your help.

MarkLeong
10-14-2001, 11:33 PM
Oh, I think alias would not help because A is a real user and should receive a copy of the mail. Using alias, A would be a virtual user and no copy of the mail would be received by A.

Or am I mistaken?

leslie
10-15-2001, 03:00 AM
Originally posted by MarkLeong:
<STRONG>Oh, I think alias would not help because A is a real user and should receive a copy of the mail. Using alias, A would be a virtual user and no copy of the mail would be received by A.

Or am I mistaken?</STRONG>


Ok forget about aliasing.... Try this...


1. create a file called .forward in user A's home directory.

2. in that file type


\a, b, c

This will retain a copy of the email for user a and also forward a copy to user b and c.

If you have anymore problems just let me know :)

leslie
10-15-2001, 03:09 AM
Here's a link that goes into more detail in regards to the .forward file.

http://www.infoboard.com/infoboard/forward.htm

MarkLeong
10-15-2001, 03:46 AM
Thanks Leslie.

What happen if somebody tries to send a mail to A but use B's email? For example, what happen if the receipient is:-

A &lt;B@someserver.com&gt;

In this case, can a copy of the mail be forwarded automatically to A@someserver.com when B receives the mail?

MarkLeong
10-21-2001, 07:15 AM
Can anyody help me with this?

X_console
10-21-2001, 11:42 AM
First, here are a few man pages that you should familiarize yourself with:

procmail(1)
procmailex(5)
procmailrc(5)

Here is an example of a .procmailrc file:


PATH=/bin:/usr/bin:/usr/bin
MAILDIR=$HOME/mail
DEFAULT=$MAILDIR/saved-messages

:0 c
* ^From.*
* ^Subject:.*
! lisa@myhost.com

:0 c
* ^From.*
* ^Subject:.*
! daniel@myhost.com

:0 c
* ^From.*
* ^Subject:.*
! simon@otherhost.com

:0
* ^From.*
* ^Subject:.
/var/mail/marie


The above is user marie's .procmailrc file. When marie receives an email, the email is copied into her mail file (/var/mail/marie) so she recieves the email. The email is also forwarded to lisa@myhost.com, daniel@myhost.com and simon@otherhost.com. So 4 people get the email that was sent to Marie.

Is this what you're looking for?

MarkLeong
10-21-2001, 08:59 PM
Thanks X-console.

Will look into your suggestion.

MarkLeong
10-28-2001, 08:45 PM
LOGFILE=/var/log/procmail
VERBOSE=on

:0:
* (^To|^cc).*jamesbond.*mark@someserver.com
!janebond@server1.inhouseserver.com

:0:
* (^To|^cc).*mark@someserver.com
!janebond@server1.inhouseserver.com

:0:
* (^To|^cc).*mark@someserver.com
!boss@server1.inhouseserver.com

//=================================

I use fetchmail to retrieve mail from someserver.com.

My promailrc file is shown above. As you can see, if I try to send mail to jamesbond &lt;mark@someserver.com&gt;, the mail would be sent to janebond@server1.inhouseserver.com.

If the mail is sent to mark@someserver.com, I want one copy to go to janebond@server1.inhouseserver.com and boss@server1.inhouseserver.com.

Somehow, boss@server1.inhouseserver.com did not receive any mail.

Is my procmailrc file correct?

Thanks in advance for assistance.