LinuxQuestions.org
Help answer threads with 0 replies.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 02-09-2006, 08:00 AM   #1
J_Szucs
Senior Member
 
Registered: Nov 2001
Location: Budapest, Hungary
Distribution: SuSE 6.4-11.3, Dsl linux, FreeBSD 4.3-6.2, Mandrake 8.2, Redhat, UHU, Debian Etch
Posts: 1,126

Rep: Reputation: 58
Using procmail to forward a copy of mails


I am trying to setup a procmailrc rule to forward a copy of each mail to an other (external) mail address.
Here is my present rule:
:0c
* !^FROM_DAEMON
* !^X-Loop: abcdefgh@foo.bar
| formail -A "X-Loop: abcdefgh@foo.bar" -I "Cc:" -I "Bc:" | $SENDMAIL -oi -t $newaddress

The problem is that the above rule does not only send the mail to "$newaddress", but also sends a copy to the address given in the "To:" field of the mail (besides, it also sends it to $LOGNAME@foo.bar).

What is the problem with the above procmailrc rule? Why are all mails sent to the "To:" address, too?

Last edited by rshaw; 02-10-2006 at 12:18 PM.
 
Old 02-09-2006, 02:18 PM   #2
unSpawn
Moderator
 
Registered: May 2001
Posts: 29,415
Blog Entries: 55

Rep: Reputation: 3590Reputation: 3590Reputation: 3590Reputation: 3590Reputation: 3590Reputation: 3590Reputation: 3590Reputation: 3590Reputation: 3590Reputation: 3590Reputation: 3590
The "c" in your procmail recipe means "CC".
 
Old 02-09-2006, 03:31 PM   #3
J_Szucs
Senior Member
 
Registered: Nov 2001
Location: Budapest, Hungary
Distribution: SuSE 6.4-11.3, Dsl linux, FreeBSD 4.3-6.2, Mandrake 8.2, Redhat, UHU, Debian Etch
Posts: 1,126

Original Poster
Rep: Reputation: 58
> The "c" in your procmail recipe means "CC".

Well, actually "c" does not really matter; e.g. if I modify the rule like this:

:0
* !^FROM_DAEMON
* !^X-Loop: abcdefgh@foo.bar
| formail -A "X-Loop: abcdefgh@foo.bar" | $SENDMAIL -oi -t $newaddress

then the mail will still be sent to two addresses: to the "To:" address, and to "$newaddress".

I simply do not understand why?
Is it sendmail or procmail that causes this unwanted behaviour?

P.S.
Naturally, it would be easy to have formail change the "To:" address to the same as "$newaddress", but then the user cannot find out by one glance that this is a redirected mail. (Plus there is a chance that two mails would be sent to "$newaddress", then?!)
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Problem with .forward and procmail Dick_Kennedy Linux - Software 0 02-03-2006 05:45 PM
QMAIL/MAILDROP/PROCMAIL: obtaining the filename used to deliver the new mails madhurtanwani Linux - Software 2 09-23-2005 01:54 AM
spamassassin & procmail forward for 1 user suhewabe Linux - Software 4 04-19-2005 01:33 PM
cant see .forward file in home directory >> mail forward/copy steve_babbage Linux - Newbie 0 03-02-2004 07:25 AM
need simple procmail & .forward help BaerRS Linux - Software 1 05-01-2003 10:41 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 12:07 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration