Hi,
I have code that places a message at the beginning of the body of an email and
it works. It is modified from an online tip, but I really want to understand
how it works so I can be better informed for similar coding.
Below is the online tip credited to Phillip Guenther – thanks. Mycode
effectively mimics this, and the log follows.
My interpretation is this:
fhw = pipe the header
Concantenate with cat onto the end of the header. I think that is what the cat
– does
Write the message with echo
Email the message
Basically then it adds to the end of the header and therefore pretends to be
the beginning of the body.
I have also observed that it only works on emails with HTML off, which is a bit
of a bother.
Am grateful for further explanations and thanks again to the person who placed
it online initially, very helpful.
Shane
ONLINE TIP
I have a really simple procmail question. All I want to do is add a line
"======= Forwarded Mail =========="
to the top of the body of all incoming messages, and forward them to another
account.
Let start by considering the first part of the question only. This is how it is
done. The solution owes heavily to Philip Guenther.
:0
{
:0 fhw
| cat - ; \
echo "===== Filtered email ====="
:0:
${DEFAULT}
}
MYCODE
#ADD TO TOP OF BODY
:0
*^To:.*Emailbodyadd
{
:0fhw
| cat - ; echo "This is entered by Me"
:0
!sreti(_at_)bidmc(_dot_)harvard(_dot_)ed
}
LOG
procmail: Match on "^To:.*Emailbodyadd"
procmail: Executing " cat - ; echo "This is entered by Shane""
procmail: Assigning "LASTFOLDER=/usr/sbin/sendmail -oi
sreti(_at_)bidmc(_dot_)harvard(_dot_)ed"
procmail: Executing
"/usr/sbin/sendmail,-oi,sreti(_at_)bidmc(_dot_)harvard(_dot_)ed"
procmail: Notified comsat: "reti@:/usr/sbin/sendmail -oi
sreti(_at_)bidmc(_dot_)harvard(_dot_)ed"
From sreti(_at_)bidmc(_dot_)harvard(_dot_)edu Tue Mar 16 08:38:36 2010
Subject: Body add test
Folder: /usr/sbin/sendmail -oi sreti(_at_)bidmc(_dot_)harvard(_dot_)ed
1337
Shane Reti (QSM), M.D.
Director, International Programs,
Project Manager, Division Facilities,
Division of Clinical Informatics,
Beth Israel Deaconess Medical Center,
330 Brookline Ave,
Boston, MA 02215
Tel: 617-667-1516
Cell: 857-445-5615
Fax: 617-667-1518
____________________________________________________________
procmail mailing list Procmail homepage: http://www.procmail.org/
procmail(_at_)lists(_dot_)RWTH-Aachen(_dot_)de
http://mailman.rwth-aachen.de/mailman/listinfo/procmail