LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
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, 07: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 11:18 AM.
 
Old 02-09-2006, 01:18 PM   #2
unSpawn
Moderator
 
Registered: May 2001
Posts: 29,415
Blog Entries: 55

Rep: Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600
The "c" in your procmail recipe means "CC".
 
Old 02-09-2006, 02: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



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 04:45 PM
QMAIL/MAILDROP/PROCMAIL: obtaining the filename used to deliver the new mails madhurtanwani Linux - Software 2 09-23-2005 12:54 AM
spamassassin & procmail forward for 1 user suhewabe Linux - Software 4 04-19-2005 12:33 PM
cant see .forward file in home directory >> mail forward/copy steve_babbage Linux - Newbie 0 03-02-2004 06:25 AM
need simple procmail & .forward help BaerRS Linux - Software 1 05-01-2003 09:41 AM

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

All times are GMT -5. The time now is 08:16 PM.

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
Open Source Consulting | Domain Registration