Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

promail forward question

70 views
Skip to first unread message

Tan Tran

unread,
Apr 27, 1996, 3:00:00 AM4/27/96
to

Hi, I don't think I see anything in procmail man pages for what I want
to do:
1) Receive mail from one address
2) Append some additional text (from a file) to incoming mail (from 1)
3) Forward the resulting mail to another address.

Could some kind soul provide the .procmailrc rule for the above ?

Thanks in advance,

+-----------------------+-----------------------------------------------+
| Tan Tran, MEE, P.E. | Disclaimer: |
| Texas Instruments | Opinions expressed are mine and in no way |
| tt...@micro.ti.com | reflect those of my employers. |
+-----------------------+-----------------------------------------------+

Steve Patlan

unread,
Apr 29, 1996, 3:00:00 AM4/29/96
to

> tt...@micro.ti.com (Tan Tran) writes:
> Hi, I don't think I see anything in procmail man pages for what I want
> to do:
> 1) Receive mail from one address
> 2) Append some additional text (from a file) to incoming mail (from 1)
> 3) Forward the resulting mail to another address.

Hmmm - well, you could plagiarize the "file-server" in the procmailex page, so you
would end up with something like this:

:0
* ^TO_yo...@yours.dom
* !^X-Loop: y...@youraddr.dom
* !^FROM_DAEMON
{
:0 fw
|formail -A "X-Loop: y...@youraddr.dom" -i "To: forw...@other.dom"

FILE="fname" # some file in your MAILDIR

:0 a
| cat - ./$FILE 2>&1 | $SENDMAIL -oi -t

:0 E :
IN.safety
}


So, for anything addressed to "your...@yours.dom" this adds a loop-prevention header
(after checking for its existence), and changes the To: address. If this step succeeds,
you append the file (whose name you assigned to an environment variable) to the msg
body and pipe the result to sendmail. If something didn't work, the message is filed
to the folder IN.safety for manual manipulation at your leisure. We are assuming that
sendmail is your MTA. (MDA?)

Note that the second "|" will cause the pipe to be started in your shell - I am just
assuming that the value of "./" is the same as MAILDIR at that point, and I'm too lazy
to wade through all the env stuff at the end of the procmail page. Just to be safe,
you may want to replace "./$FILE" with "$FILE", and set the value of FILE to the full
pathname of your append file. (Or you could just put the file in your home dir, and
make a link in your maildir. Or put files with the same name and different contents in
the two locations and see which one gets sent.)


Corrections, etc, welcome.

-Steve


Phil N. Schuman

unread,
May 6, 1996, 3:00:00 AM5/6/96
to

here's another forwarding question -
I have several accounts that I would like to forward -
I have a small testing script/receipe - I would like to add a little tag line to the FROM
like - FROM: xxxxxxx (via XYZ Procmail postoffice)
so I can tell that it passed thru the PROCMAIL process -

any ideas - Phil -

here is my little script -
with the last line that retains the msg in the mail Q for later retrieval
in case it falls thru and does not match any names ...

:0
* ^TOphili
{ :0
! psch...@interserv.com
}

:0
* ^TOphils
{ :0
! ph...@symons.com
}

:0
* ^TOphilo
{ :0
! ph...@otcg.com
}

:0 hb
/var/mail/omnitech

/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/
Imagination is more important than knowledge.....
Knowledge is limited.....
Imagination is not....... Albert Einstein, (1879-1955)


Waldi Ravens

unread,
May 8, 1996, 3:00:00 AM5/8/96
to

Phil N. Schuman <psch...@interserv.com> wrote:
> I would like to add a little tag line to the FROM
> like - FROM: xxxxxxx (via XYZ Procmail postoffice)
> so I can tell that it passed thru the PROCMAIL process -

:0
* ^TOphili
{ NEWFROM="`formail -XFrom:` (via XYZ Procmail postoffice)"
:0 fhw
| formail -I"${NEWFROM}"
:0
! psch...@interserv.com
}

:0
* ^TOphils
{ NEWFROM="`formail -XFrom:` (via XYZ Procmail postoffice)"
:0 fhw
| formail -I"${NEWFROM}"
:0
! ph...@symons.com
}

:0
* ^TOphilo
{ NEWFROM="`formail -XFrom:` (via XYZ Procmail postoffice)"
:0 fhw
| formail -I"${NEWFROM}"
:0
! ph...@otcg.com
}

:0 :
/var/mail/omnitech

(The last recipe should use a lockfile; the hb flags can be omitted.)


Regards,
Waldi
--
Never let your schooling interfere with your education.

0 new messages